Add JS_HasException() (#265)

This commit is contained in:
Kasper Isager Dalsgarð 2024-05-08 23:19:15 +02:00 committed by GitHub
parent 6c43013140
commit db9dbd0a2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -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;

View file

@ -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);