mirror of https://github.com/pyodide/pyodide.git
Fine tuning of error_handling debug tools (#1142)
This commit is contained in:
parent
4c5c30779f
commit
603d223b7b
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <emscripten.h>
|
||||
|
||||
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; \
|
||||
} \
|
||||
|
|
Loading…
Reference in New Issue