mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 13:22:07 +00:00
rid nearly all use of ExceptionRef in zig (#15100)
Co-authored-by: nektro <nektro@users.noreply.github.com>
This commit is contained in:
@@ -35,32 +35,20 @@ fn callSync(comptime FunctionEnum: NodeFSFunctionEnum) NodeFSFunction {
|
||||
globalObject: *JSC.JSGlobalObject,
|
||||
callframe: *JSC.CallFrame,
|
||||
) JSC.JSValue {
|
||||
var exceptionref: JSC.C.JSValueRef = null;
|
||||
|
||||
var arguments = callframe.arguments(8);
|
||||
|
||||
var slice = ArgumentsSlice.init(globalObject.bunVM(), arguments.slice());
|
||||
defer slice.deinit();
|
||||
|
||||
const args = if (comptime Arguments != void)
|
||||
(Arguments.fromJS(globalObject, &slice, &exceptionref) orelse {
|
||||
// we might've already thrown
|
||||
if (exceptionref != null)
|
||||
globalObject.throwValue(JSC.JSValue.c(exceptionref));
|
||||
return .zero;
|
||||
})
|
||||
(Arguments.fromJS(globalObject, &slice) catch return .zero)
|
||||
else
|
||||
Arguments{};
|
||||
defer {
|
||||
if (comptime Arguments != void and @hasDecl(Arguments, "deinit")) args.deinit();
|
||||
}
|
||||
|
||||
const exception1 = JSC.JSValue.c(exceptionref);
|
||||
|
||||
if (exception1 != .zero) {
|
||||
globalObject.throwValue(exception1);
|
||||
return .zero;
|
||||
} else if (globalObject.hasException()) {
|
||||
if (globalObject.hasException()) {
|
||||
return .zero;
|
||||
}
|
||||
var result = Function(
|
||||
@@ -96,25 +84,15 @@ fn call(comptime FunctionEnum: NodeFSFunctionEnum) NodeFSFunction {
|
||||
|
||||
var slice = ArgumentsSlice.init(globalObject.bunVM(), arguments.slice());
|
||||
slice.will_be_async = true;
|
||||
var exceptionref: JSC.C.JSValueRef = null;
|
||||
const args = if (comptime Arguments != void)
|
||||
(Arguments.fromJS(globalObject, &slice, &exceptionref) orelse {
|
||||
// we might've already thrown
|
||||
if (exceptionref != null)
|
||||
globalObject.throwValue(JSC.JSValue.c(exceptionref));
|
||||
(Arguments.fromJS(globalObject, &slice) catch {
|
||||
slice.deinit();
|
||||
return .zero;
|
||||
})
|
||||
else
|
||||
Arguments{};
|
||||
|
||||
const exception1 = JSC.JSValue.c(exceptionref);
|
||||
|
||||
if (exception1 != .zero) {
|
||||
globalObject.throwValue(exception1);
|
||||
slice.deinit();
|
||||
return .zero;
|
||||
} else if (globalObject.hasException()) {
|
||||
if (globalObject.hasException()) {
|
||||
slice.deinit();
|
||||
return .zero;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user