Skip to content

Commit a3f99cc

Browse files
committed
fix .extend not working in quickjs
We need to ensure the errors created via public API JS_NewError include .stack property.
1 parent dee6757 commit a3f99cc

File tree

1 file changed

+4
-1
lines changed
  • test-app/runtime/src/main/cpp/napi/quickjs/source

1 file changed

+4
-1
lines changed

test-app/runtime/src/main/cpp/napi/quickjs/source/quickjs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7217,7 +7217,10 @@ static BOOL is_backtrace_needed(JSContext *ctx, JSValueConst obj)
72177217

72187218
JSValue JS_NewError(JSContext *ctx)
72197219
{
7220-
return JS_NewObjectClass(ctx, JS_CLASS_ERROR);
7220+
JSValue error = JS_NewObjectClass(ctx, JS_CLASS_ERROR);
7221+
build_backtrace(ctx, error, NULL, 0, 0, 0);
7222+
return error;
7223+
72217224
}
72227225

72237226
static JSValue JS_ThrowError2(JSContext *ctx, JSErrorEnum error_num,

0 commit comments

Comments
 (0)