diff options
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(); } |