Skip to content

Commit f507557

Browse files
authored
Only look up .stack property on exception objects (#905)
Without this additional check, run-test262 prints "TypeError: cannot read property 'stack' of undefined" when a test throws undefined, obscuring the actual error.
1 parent 5a949ca commit f507557

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

run-test262.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ static int eval_buf(JSContext *ctx, const char *buf, size_t buf_len,
15481548
}
15491549
}
15501550
}
1551-
if (is_unexpected_error && verbose > 1) {
1551+
if (is_unexpected_error && verbose > 1 && JS_IsException(exception_val)) {
15521552
JSValue val = JS_GetPropertyStr(ctx, exception_val, "stack");
15531553
if (!JS_IsException(val) &&
15541554
!JS_IsUndefined(val) &&

0 commit comments

Comments
 (0)