@@ -1700,7 +1700,7 @@ JSRuntime *JS_NewRuntime2(const JSMallocFunctions *mf, void *opaque)
1700
1700
#endif
1701
1701
JS_UpdateStackTop(rt);
1702
1702
1703
- rt->current_exception = JS_NULL ;
1703
+ rt->current_exception = JS_UNINITIALIZED ;
1704
1704
1705
1705
return rt;
1706
1706
fail:
@@ -6353,10 +6353,15 @@ JSValue JS_GetException(JSContext *ctx)
6353
6353
JSValue val;
6354
6354
JSRuntime *rt = ctx->rt;
6355
6355
val = rt->current_exception;
6356
- rt->current_exception = JS_NULL ;
6356
+ rt->current_exception = JS_UNINITIALIZED ;
6357
6357
return val;
6358
6358
}
6359
6359
6360
+ JS_BOOL JS_HasException(JSContext *ctx)
6361
+ {
6362
+ return !JS_IsUninitialized(ctx->rt->current_exception);
6363
+ }
6364
+
6360
6365
static void dbuf_put_leb128(DynBuf *s, uint32_t v)
6361
6366
{
6362
6367
uint32_t a;
@@ -13803,7 +13808,7 @@ static int JS_IteratorClose(JSContext *ctx, JSValue enum_obj,
13803
13808
13804
13809
if (is_exception_pending) {
13805
13810
ex_obj = ctx->rt->current_exception;
13806
- ctx->rt->current_exception = JS_NULL ;
13811
+ ctx->rt->current_exception = JS_UNINITIALIZED ;
13807
13812
res = -1;
13808
13813
} else {
13809
13814
ex_obj = JS_UNDEFINED;
@@ -17174,7 +17179,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValue func_obj,
17174
17179
JS_IteratorClose(ctx, sp[-1], TRUE);
17175
17180
} else {
17176
17181
*sp++ = rt->current_exception;
17177
- rt->current_exception = JS_NULL ;
17182
+ rt->current_exception = JS_UNINITIALIZED ;
17178
17183
pc = b->byte_code_buf + pos;
17179
17184
goto restart;
17180
17185
}
0 commit comments