Add JS_HasException() (#265)

Author:    Kasper Isager Dalsgarð <kasperisager@hey.com>
Date:      Wed May 8 23:19:15 2024 +0200
This commit is contained in:
Kasper Isager Dalsgarð 2024-05-08 23:19:15 +02:00 committed by Charlie Gordon
parent f9ecc1a598
commit f3bf7afb62
2 changed files with 6 additions and 0 deletions

View file

@ -6305,6 +6305,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;

View file

@ -570,6 +570,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_EXTERN 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);