mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +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:
@@ -826,7 +826,7 @@ pub const String = extern struct {
|
||||
jsc.markBinding(@src());
|
||||
var builder = std.ArrayList(u8).init(bun.default_allocator);
|
||||
defer builder.deinit();
|
||||
builder.writer().print(fmt, args) catch bun.outOfMemory();
|
||||
bun.handleOom(builder.writer().print(fmt, args));
|
||||
return bun.cpp.BunString__createUTF8ForJS(globalObject, builder.items.ptr, builder.items.len);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user