diff --git a/src/core/error_handling.c b/src/core/error_handling.c index 4da49f041..37fe9ef44 100644 --- a/src/core/error_handling.c +++ b/src/core/error_handling.c @@ -11,6 +11,12 @@ EM_JS_NUM(errcode, log_error, (char* msg), { console.error(jsmsg); }); +// Right now this is dead code (probably), please don't remove it. +// Intended for debugging purposes. +EM_JS_NUM(errcode, log_error_obj, (JsRef obj), { + console.error(Module.hiwire.get_value(obj)); +}); + void PyodideErr_SetJsError(JsRef err) { diff --git a/src/core/error_handling.h b/src/core/error_handling.h index ae0ed65dc..d32329f3e 100644 --- a/src/core/error_handling.h +++ b/src/core/error_handling.h @@ -7,6 +7,7 @@ #include typedef int errcode; +#include "hiwire.h" int error_handling_init(); @@ -14,6 +15,11 @@ error_handling_init(); errcode log_error(char* msg); +// Right now this is dead code (probably), please don't remove it. +// Intended for debugging purposes. +errcode +log_error_obj(JsRef obj); + /** EM_JS Wrappers * Wrap EM_JS so that it produces functions that follow the Python return * conventions. We catch javascript errors and proxy them and use @@ -59,7 +65,7 @@ log_error(char* msg); try /* intentionally no braces, body already has them */ \ body /* <== body of func */ \ catch (e) { \ - LOG_EM_JS_ERROR(func_name, err); \ + LOG_EM_JS_ERROR(func_name, e); \ Module.handle_js_error(e); \ return 0; \ } \ @@ -74,7 +80,7 @@ log_error(char* msg); try /* intentionally no braces, body already has them */ \ body /* <== body of func */ \ catch (e) { \ - LOG_EM_JS_ERROR(func_name, err); \ + LOG_EM_JS_ERROR(func_name, e); \ Module.handle_js_error(e); \ return -1; \ } \