diff options
author | Florian Dold <florian.dold@gmail.com> | 2015-12-14 11:26:55 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2015-12-14 11:26:55 +0100 |
commit | e92d26a93781820391174e95c484956aa90cf8fb (patch) | |
tree | f500f49973f90cafe87cecc6b00e2527aa4ca316 /extension/background/emscriptif.js | |
parent | 9d43bd45ecdaa2874dc2b110f3f1f03019ef1bad (diff) |
More typescript.
Diffstat (limited to 'extension/background/emscriptif.js')
-rw-r--r-- | extension/background/emscriptif.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/extension/background/emscriptif.js b/extension/background/emscriptif.js index ee864c60d..a4e50b89e 100644 --- a/extension/background/emscriptif.js +++ b/extension/background/emscriptif.js @@ -127,7 +127,8 @@ class Amount extends ArenaObject { * Perform saturating subtraction on amounts. */ sub(a) { - let res = emsc.amount_subtract(this.nativePtr, a.nativePtr, this.nativePtr); + // this = this - a + let res = emsc.amount_subtract(this.nativePtr, this.nativePtr, a.nativePtr); if (res == 0) { // Underflow return false; @@ -135,7 +136,7 @@ class Amount extends ArenaObject { if (res > 0) { return true; } - throw "Incompatible currencies"; + throw Error("Incompatible currencies"); } cmp(a) { return emsc.amount_cmp(this.nativePtr, a.nativePtr); @@ -256,7 +257,7 @@ class SignatureStruct { let name = f[0]; let member = this.members[name]; if (!member) { - throw { error: "Member not set", key: name }; + throw Error(format("Member {0} not set", name)); } totalSize += this.members[name].size(); } |