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:
@@ -82,12 +82,12 @@ pub fn setEnv(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe:
|
||||
// PATH = "";
|
||||
|
||||
while (try object_iter.next()) |key| {
|
||||
const keyslice = key.toOwnedSlice(bun.default_allocator) catch bun.outOfMemory();
|
||||
const keyslice = bun.handleOom(key.toOwnedSlice(bun.default_allocator));
|
||||
var value = object_iter.value;
|
||||
if (value.isUndefined()) continue;
|
||||
|
||||
const value_str = try value.getZigString(globalThis);
|
||||
const slice = value_str.toOwnedSlice(bun.default_allocator) catch bun.outOfMemory();
|
||||
const slice = bun.handleOom(value_str.toOwnedSlice(bun.default_allocator));
|
||||
const keyref = EnvStr.initRefCounted(keyslice);
|
||||
defer keyref.deref();
|
||||
const valueref = EnvStr.initRefCounted(slice);
|
||||
|
||||
Reference in New Issue
Block a user