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.ts | |
parent | 9d43bd45ecdaa2874dc2b110f3f1f03019ef1bad (diff) |
More typescript.
Diffstat (limited to 'extension/background/emscriptif.ts')
-rw-r--r-- | extension/background/emscriptif.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/extension/background/emscriptif.ts b/extension/background/emscriptif.ts index 5ca4fef24..49ed3c943 100644 --- a/extension/background/emscriptif.ts +++ b/extension/background/emscriptif.ts @@ -19,6 +19,7 @@ declare var Module : any; + // Size of a native pointer. const PTR_SIZE = 4; @@ -202,7 +203,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; @@ -210,7 +212,7 @@ class Amount extends ArenaObject { if (res > 0) { return true; } - throw "Incompatible currencies"; + throw Error("Incompatible currencies"); } cmp(a) { @@ -365,7 +367,7 @@ abstract 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(); } |