zig: make all JS constructors use JSError (#15146)

Co-authored-by: Ciro Spaciari <ciro.spaciari@gmail.com>
This commit is contained in:
Meghan Denny
2024-11-14 16:36:01 -08:00
committed by GitHub
parent 3170b88058
commit 2810f39802
24 changed files with 205 additions and 369 deletions

View File

@@ -404,10 +404,9 @@ pub const PostgresSQLQuery = struct {
});
}
pub fn constructor(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) ?*PostgresSQLQuery {
pub fn constructor(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!*PostgresSQLQuery {
_ = callframe;
globalThis.throw("PostgresSQLQuery cannot be constructed directly", .{});
return null;
return globalThis.throw2("PostgresSQLQuery cannot be constructed directly", .{});
}
pub fn estimatedSize(this: *PostgresSQLQuery) usize {
@@ -1213,10 +1212,9 @@ pub const PostgresSQLConnection = struct {
}
}
pub fn constructor(globalObject: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) ?*PostgresSQLConnection {
pub fn constructor(globalObject: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!*PostgresSQLConnection {
_ = callframe;
globalObject.throw("PostgresSQLConnection cannot be constructed directly", .{});
return null;
return globalObject.throw2("PostgresSQLConnection cannot be constructed directly", .{});
}
comptime {