Skip to content

Commit a16b1d7

Browse files
committed
[TS] log when an exception is thrown inside of a trait call
This was what #125 was supposed to be about, but the issue description was overly vague.
1 parent f8f3544 commit a16b1d7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

typescript_strings.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,14 @@ def cleanup(self):
16381638
console.error("Got function call with id " + fn_id + " on incorrect JS object: " + obj);
16391639
throw new Error("Got function call with id " + fn_id + " on incorrect JS object: " + obj);
16401640
}
1641-
const ret = fn.value.bind(obj)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
1641+
var ret;
1642+
try {
1643+
ret = fn.value.bind(obj)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
1644+
} catch (e) {
1645+
console.error("Got an exception calling function with id " + fn_id + "! This is fatal.");
1646+
console.error(e);
1647+
throw e;
1648+
}
16421649
if (ret === undefined || ret === null) return BigInt(0);
16431650
return BigInt(ret);
16441651
}""")

0 commit comments

Comments
 (0)