Skip to content

Commit db9dbd0

Browse files
authored
Add JS_HasException() (bellard#265)
1 parent 6c43013 commit db9dbd0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

quickjs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6402,6 +6402,11 @@ JSValue JS_GetException(JSContext *ctx)
64026402
return val;
64036403
}
64046404

6405+
JS_BOOL JS_HasException(JSContext *ctx)
6406+
{
6407+
return !JS_IsNull(ctx->rt->current_exception);
6408+
}
6409+
64056410
static void dbuf_put_leb128(DynBuf *s, uint32_t v)
64066411
{
64076412
uint32_t a;

quickjs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ static inline JS_BOOL JS_IsObject(JSValueConst v)
633633

634634
JSValue JS_Throw(JSContext *ctx, JSValue obj);
635635
JSValue JS_GetException(JSContext *ctx);
636+
JS_BOOL JS_HasException(JSContext *ctx);
636637
JS_BOOL JS_IsError(JSContext *ctx, JSValueConst val);
637638
void JS_ResetUncatchableError(JSContext *ctx);
638639
JSValue JS_NewError(JSContext *ctx);

0 commit comments

Comments
 (0)