mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
parent
8557bd0a0a
commit
56da486312
2 changed files with 10 additions and 4 deletions
13
quickjs.c
13
quickjs.c
|
@ -1700,7 +1700,7 @@ JSRuntime *JS_NewRuntime2(const JSMallocFunctions *mf, void *opaque)
|
|||
#endif
|
||||
JS_UpdateStackTop(rt);
|
||||
|
||||
rt->current_exception = JS_NULL;
|
||||
rt->current_exception = JS_UNINITIALIZED;
|
||||
|
||||
return rt;
|
||||
fail:
|
||||
|
@ -6353,10 +6353,15 @@ JSValue JS_GetException(JSContext *ctx)
|
|||
JSValue val;
|
||||
JSRuntime *rt = ctx->rt;
|
||||
val = rt->current_exception;
|
||||
rt->current_exception = JS_NULL;
|
||||
rt->current_exception = JS_UNINITIALIZED;
|
||||
return val;
|
||||
}
|
||||
|
||||
JS_BOOL JS_HasException(JSContext *ctx)
|
||||
{
|
||||
return !JS_IsUninitialized(ctx->rt->current_exception);
|
||||
}
|
||||
|
||||
static void dbuf_put_leb128(DynBuf *s, uint32_t v)
|
||||
{
|
||||
uint32_t a;
|
||||
|
@ -13803,7 +13808,7 @@ static int JS_IteratorClose(JSContext *ctx, JSValue enum_obj,
|
|||
|
||||
if (is_exception_pending) {
|
||||
ex_obj = ctx->rt->current_exception;
|
||||
ctx->rt->current_exception = JS_NULL;
|
||||
ctx->rt->current_exception = JS_UNINITIALIZED;
|
||||
res = -1;
|
||||
} else {
|
||||
ex_obj = JS_UNDEFINED;
|
||||
|
@ -17174,7 +17179,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValue func_obj,
|
|||
JS_IteratorClose(ctx, sp[-1], TRUE);
|
||||
} else {
|
||||
*sp++ = rt->current_exception;
|
||||
rt->current_exception = JS_NULL;
|
||||
rt->current_exception = JS_UNINITIALIZED;
|
||||
pc = b->byte_code_buf + pos;
|
||||
goto restart;
|
||||
}
|
||||
|
|
|
@ -585,6 +585,7 @@ static inline JS_BOOL JS_IsObject(JSValue v)
|
|||
|
||||
JS_EXTERN JSValue JS_Throw(JSContext *ctx, JSValue obj);
|
||||
JS_EXTERN JSValue JS_GetException(JSContext *ctx);
|
||||
JS_BOOL JS_HasException(JSContext *ctx);
|
||||
JS_EXTERN JS_BOOL JS_IsError(JSContext *ctx, JSValue val);
|
||||
JS_EXTERN void JS_ResetUncatchableError(JSContext *ctx);
|
||||
JS_EXTERN JSValue JS_NewError(JSContext *ctx);
|
||||
|
|
Loading…
Reference in a new issue