Skip to content

Commit

Permalink
Add JS_HasException() (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager authored May 8, 2024
1 parent 6c43013 commit db9dbd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6402,6 +6402,11 @@ JSValue JS_GetException(JSContext *ctx)
return val;
}

JS_BOOL JS_HasException(JSContext *ctx)
{
return !JS_IsNull(ctx->rt->current_exception);
}

static void dbuf_put_leb128(DynBuf *s, uint32_t v)
{
uint32_t a;
Expand Down
1 change: 1 addition & 0 deletions quickjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ static inline JS_BOOL JS_IsObject(JSValueConst v)

JSValue JS_Throw(JSContext *ctx, JSValue obj);
JSValue JS_GetException(JSContext *ctx);
JS_BOOL JS_HasException(JSContext *ctx);
JS_BOOL JS_IsError(JSContext *ctx, JSValueConst val);
void JS_ResetUncatchableError(JSContext *ctx);
JSValue JS_NewError(JSContext *ctx);
Expand Down

0 comments on commit db9dbd0

Please sign in to comment.