[TS] log when an exception is thrown inside of a trait call
[ldk-java] / typescript_strings.py
index 59b1e40211548d566e4ef3995e75f076b7fc6501..89aa57a22b2d3f29bd68bbf45809f3ec2d5a3afe 100644 (file)
@@ -361,6 +361,7 @@ export async function initializeWasmFromBinary(bin: Uint8Array) {
        await initializeWasmFromUint8Array(bin);
 }
 
+export * from './structs/UtilMethods.mjs';
 """)
 
         self.bindings_version_file = """export function get_ldk_java_bindings_version(): String {
@@ -1637,7 +1638,14 @@ js_invoke = function(obj_ptr: number, fn_id: number, arg1: bigint|number, arg2:
                console.error("Got function call with id " + fn_id + " on incorrect JS object: " + obj);
                throw new Error("Got function call with id " + fn_id + " on incorrect JS object: " + obj);
        }
-       const ret = fn.value.bind(obj)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
+       var ret;
+       try {
+               ret = fn.value.bind(obj)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
+       } catch (e) {
+               console.error("Got an exception calling function with id " + fn_id + "! This is fatal.");
+               console.error(e);
+               throw e;
+       }
        if (ret === undefined || ret === null) return BigInt(0);
        return BigInt(ret);
 }""")