diff options
author | 2023-07-11 20:52:10 -0700 | |
---|---|---|
committer | 2023-07-11 20:52:10 -0700 | |
commit | 666feb3b7e3fdfaa9e1cb7ece39095a83df09fd1 (patch) | |
tree | 1ae7b316fb3941c3d2fdf53dc85e6503267335b0 /src/bun.js/bindings/helpers.h | |
parent | 5ea32a976ec85ac7cb4b2e56aaa3e5c2cb9e9bf1 (diff) | |
download | bun-666feb3b7e3fdfaa9e1cb7ece39095a83df09fd1.tar.gz bun-666feb3b7e3fdfaa9e1cb7ece39095a83df09fd1.tar.zst bun-666feb3b7e3fdfaa9e1cb7ece39095a83df09fd1.zip |
Fix crash on linux when throwing SystemError from C++
Diffstat (limited to 'src/bun.js/bindings/helpers.h')
-rw-r--r-- | src/bun.js/bindings/helpers.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/bun.js/bindings/helpers.h b/src/bun.js/bindings/helpers.h index 00777c304..79aa3d472 100644 --- a/src/bun.js/bindings/helpers.h +++ b/src/bun.js/bindings/helpers.h @@ -391,6 +391,19 @@ static JSC::JSValue getRangeErrorInstance(const ZigString* str, JSC__JSGlobalObj }; // namespace Zig +JSC::JSValue createSystemError(JSC::JSGlobalObject* global, ASCIILiteral message, ASCIILiteral syscall, int err); +JSC::JSValue createSystemError(JSC::JSGlobalObject* global, ASCIILiteral syscall, int err); + +static void throwSystemError(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, ASCIILiteral syscall, int err) +{ + scope.throwException(globalObject, createSystemError(globalObject, syscall, err)); +} + +static void throwSystemError(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, ASCIILiteral message, ASCIILiteral syscall, int err) +{ + scope.throwException(globalObject, createSystemError(globalObject, message, syscall, err)); +} + template<typename WebCoreType, typename OutType> OutType* WebCoreCast(JSC__JSValue JSValue0) { |