aboutsummaryrefslogtreecommitdiff
path: root/extension/background/emscriptif.js
diff options
context:
space:
mode:
Diffstat (limited to 'extension/background/emscriptif.js')
-rw-r--r--extension/background/emscriptif.js7
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();
}