better info in runtime constraint assertion

This commit is contained in:
Jordi Baylina 2019-09-15 10:49:19 +02:00
parent d2ccc9dce5
commit 2fa9503ad6
No known key found for this signature in database
GPG Key ID: 7480C80C1BE43112
2 changed files with 7 additions and 2 deletions

View File

@ -226,6 +226,11 @@ if (typeof(BigInt) != "undefined") {
return this != b;
};
wBigInt.prototype.toJSNumber = function() {
return Number(this);
};
} else {
var oldProto = bigInt.prototype;

View File

@ -223,11 +223,11 @@ class RTCtx {
return this.witness[sId];
}
assert(a,b) {
assert(a,b,errStr) {
const ba = bigInt(a);
const bb = bigInt(b);
if (!ba.equals(bb)) {
throw new Error("Constraint doesn't match: " + ba.toString() + " != " + bb.toString());
throw new Error("Constraint doesn't match "+ this.currentComponent+": "+ errStr + " -> "+ ba.toString() + " != " + bb.toString());
}
}
}