mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Replace catch bun.outOfMemory() with safer alternatives (#22141)
Replace `catch bun.outOfMemory()`, which can accidentally catch non-OOM-related errors, with either `bun.handleOom` or a manual `catch |err| switch (err)`. (For internal tracking: fixes STAB-1070) --------- Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
This commit is contained in:
@@ -333,7 +333,7 @@ pub fn failWithJSValue(this: *PostgresSQLConnection, value: JSValue) void {
|
||||
}
|
||||
|
||||
pub fn failFmt(this: *PostgresSQLConnection, code: []const u8, comptime fmt: [:0]const u8, args: anytype) void {
|
||||
const message = std.fmt.allocPrint(bun.default_allocator, fmt, args) catch bun.outOfMemory();
|
||||
const message = bun.handleOom(std.fmt.allocPrint(bun.default_allocator, fmt, args));
|
||||
defer bun.default_allocator.free(message);
|
||||
|
||||
const err = createPostgresError(this.globalObject, message, .{ .code = code }) catch |e| this.globalObject.takeError(e);
|
||||
|
||||
Reference in New Issue
Block a user