diff options
Diffstat (limited to 'src/bun.js/bindings/helpers.h')
-rw-r--r-- | src/bun.js/bindings/helpers.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/bun.js/bindings/helpers.h b/src/bun.js/bindings/helpers.h index 382c760f3..8a96a94af 100644 --- a/src/bun.js/bindings/helpers.h +++ b/src/bun.js/bindings/helpers.h @@ -340,6 +340,36 @@ static JSC::JSValue getErrorInstance(const ZigString* str, JSC__JSGlobalObject* return JSC::JSValue(result); } +static JSC::JSValue getTypeErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +{ + JSC::VM& vm = globalObject->vm(); + + JSC::JSObject* result = JSC::createTypeError(globalObject, toStringCopy(*str)); + JSC::EnsureStillAliveScope ensureAlive(result); + + return JSC::JSValue(result); +} + +static JSC::JSValue getSyntaxErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +{ + JSC::VM& vm = globalObject->vm(); + + JSC::JSObject* result = JSC::createSyntaxError(globalObject, toStringCopy(*str)); + JSC::EnsureStillAliveScope ensureAlive(result); + + return JSC::JSValue(result); +} + +static JSC::JSValue getRangeErrorInstance(const ZigString* str, JSC__JSGlobalObject* globalObject) +{ + JSC::VM& vm = globalObject->vm(); + + JSC::JSObject* result = JSC::createRangeError(globalObject, toStringCopy(*str)); + JSC::EnsureStillAliveScope ensureAlive(result); + + return JSC::JSValue(result); +} + }; // namespace Zig template<typename WebCoreType, typename OutType> |