From 397201c278ded558e45d406967f153770784ff88 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 8 Mar 2023 06:04:01 +0000 Subject: [PATCH] [TS] Slightly improve logging in TS trait calls that fail Not actually 100% sure what we can do much better on the logging front, but this is at least a marginal improvement. Fixes #125. --- typescript_strings.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/typescript_strings.py b/typescript_strings.py index b387fd4d..59b1e402 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -1630,12 +1630,12 @@ js_invoke = function(obj_ptr: number, fn_id: number, arg1: bigint|number, arg2: bindings.write(f"\t\tcase {str(f)}: fn = Object.getOwnPropertyDescriptor(obj, \"{self.function_ptrs[f][1]}\"); break;\n") bindings.write("""\t\tdefault: - console.error("Got unknown function call from C!"); - throw new Error("Got unknown function call from C!"); + console.error("Got unknown function call with id " + fn_id + " from C!"); + throw new Error("Got unknown function call with id " + fn_id + " from C!"); } if (fn == null || fn == undefined) { - console.error("Got function call on incorrect JS object!"); - throw new Error("Got function call on incorrect JS object!"); + 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); if (ret === undefined || ret === null) return BigInt(0); -- 2.39.5