mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 05:42:43 +00:00
zig: make throwInvalidArguments use JSError (#15305)
This commit is contained in:
@@ -26,13 +26,11 @@ pub fn setDefaultAutoSelectFamily(global: *JSC.JSGlobalObject) JSC.JSValue {
|
||||
fn setter(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
|
||||
const arguments = callframe.arguments_old(1);
|
||||
if (arguments.len < 1) {
|
||||
globalThis.throw("missing argument", .{});
|
||||
return .undefined;
|
||||
return globalThis.throw2("missing argument", .{});
|
||||
}
|
||||
const arg = arguments.slice()[0];
|
||||
if (!arg.isBoolean()) {
|
||||
globalThis.throwInvalidArguments("autoSelectFamilyDefault", .{});
|
||||
return .undefined;
|
||||
return globalThis.throwInvalidArguments("autoSelectFamilyDefault", .{});
|
||||
}
|
||||
const value = arg.toBoolean();
|
||||
autoSelectFamilyDefault = value;
|
||||
@@ -61,13 +59,11 @@ pub fn setDefaultAutoSelectFamilyAttemptTimeout(global: *JSC.JSGlobalObject) JSC
|
||||
fn setter(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
|
||||
const arguments = callframe.arguments_old(1);
|
||||
if (arguments.len < 1) {
|
||||
globalThis.throw("missing argument", .{});
|
||||
return .undefined;
|
||||
return globalThis.throw2("missing argument", .{});
|
||||
}
|
||||
const arg = arguments.slice()[0];
|
||||
if (!arg.isInt32AsAnyInt()) {
|
||||
globalThis.throwInvalidArguments("autoSelectFamilyAttemptTimeoutDefault", .{});
|
||||
return .undefined;
|
||||
return globalThis.throwInvalidArguments("autoSelectFamilyAttemptTimeoutDefault", .{});
|
||||
}
|
||||
const value: u32 = @max(10, arg.coerceToInt32(globalThis));
|
||||
autoSelectFamilyAttemptTimeoutDefault = value;
|
||||
|
||||
Reference in New Issue
Block a user