This commit is contained in:
ekibun
2021-01-26 01:20:25 +08:00
parent b790073045
commit 896d563ba8
9 changed files with 166 additions and 89 deletions

View File

@@ -13,9 +13,9 @@
extern "C"
{
DLLEXPORT JSValue *jsThrowInternalError(JSContext *ctx, char *message)
DLLEXPORT JSValue *jsThrow(JSContext *ctx, JSValue *obj)
{
return new JSValue(JS_ThrowInternalError(ctx, "%s", message));
return new JSValue(JS_Throw(ctx, *obj));
}
DLLEXPORT JSValue *jsEXCEPTION()
@@ -293,6 +293,16 @@ extern "C"
return JS_IsArray(ctx, *val);
}
DLLEXPORT int32_t jsIsError(JSContext *ctx, JSValueConst *val)
{
return JS_IsError(ctx, *val);
}
DLLEXPORT JSValue *jsNewError(JSContext *ctx)
{
return new JSValue(JS_NewError(ctx));
}
DLLEXPORT JSValue *jsGetProperty(JSContext *ctx, JSValueConst *this_obj,
JSAtom prop)
{

View File

@@ -17,7 +17,7 @@ extern "C"
typedef void *JSChannel(JSContext *ctx, size_t type, void *argv);
DLLEXPORT JSValue *jsThrowInternalError(JSContext *ctx, char *message);
DLLEXPORT JSValue *jsThrow(JSContext *ctx, JSValue *obj);
DLLEXPORT JSValue *jsEXCEPTION();
@@ -95,6 +95,10 @@ extern "C"
DLLEXPORT int32_t jsIsArray(JSContext *ctx, JSValueConst *val);
DLLEXPORT int32_t jsIsError(JSContext *ctx, JSValueConst *val);
DLLEXPORT JSValue *jsNewError(JSContext *ctx);
DLLEXPORT JSValue *jsGetProperty(JSContext *ctx, JSValueConst *this_obj,
JSAtom prop);