diff --git a/javascript/dukky.c b/javascript/dukky.c index 3e70b02fd..90c7247e1 100644 --- a/javascript/dukky.c +++ b/javascript/dukky.c @@ -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);