Log more of the JS error object

This commit is contained in:
Daniel Silverstone 2015-08-12 15:39:34 +02:00
parent e331784ea3
commit 1ee30e7632

View File

@ -391,7 +391,16 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
duk_push_lstring(CTX, txt, txtlen);
if (duk_safe_call(CTX, eval_top_string, 1, 1) == DUK_EXEC_ERROR) {
LOG("JAVASCRIPT WENT BANG: %s", duk_safe_to_string(CTX, 0));
duk_get_prop_string(CTX, 0, "name");
duk_get_prop_string(CTX, 0, "message");
duk_get_prop_string(CTX, 0, "fileName");
duk_get_prop_string(CTX, 0, "lineNumber");
duk_get_prop_string(CTX, 0, "stack");
LOG("JAVASCRIPT WENT BANG: %s: %s", duk_safe_to_string(CTX, 1),
duk_safe_to_string(CTX, 2));
LOG("Explosion was at %s line %s", duk_safe_to_string(CTX, 3),
duk_safe_to_string(CTX, 4));
LOG("Stack trace:\n%s", duk_safe_to_string(CTX, 5));
return false;
}
if (duk_get_top(CTX) == 0) duk_push_boolean(CTX, false);