From 2166a172a75b0643c35037af1ef27b85683f60ac Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 18 Jan 2024 17:25:14 +0800 Subject: [PATCH] feat: print message in dump_error --- quickjs-libc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/quickjs-libc.c b/quickjs-libc.c index 99b4c5f4d..db8c60f40 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -3872,6 +3872,12 @@ static void js_std_dump_error1(JSContext *ctx, JSValue exception_val) is_error = JS_IsError(ctx, exception_val); js_dump_obj(ctx, stderr, exception_val); if (is_error) { + val = JS_GetPropertyStr(ctx, exception_val, "message"); + if (!JS_IsUndefined(val)) { + js_dump_obj(ctx, stderr, val); + } + JS_FreeValue(ctx, val); + val = JS_GetPropertyStr(ctx, exception_val, "stack"); if (!JS_IsUndefined(val)) { js_dump_obj(ctx, stderr, val);