mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 11:29:02 +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:
@@ -370,14 +370,14 @@ pub const UpdateInteractiveCommand = struct {
|
||||
original_cwd,
|
||||
manager,
|
||||
filters,
|
||||
) catch bun.outOfMemory();
|
||||
) catch |err| bun.handleOom(err);
|
||||
} else if (manager.options.do.recursive) blk: {
|
||||
break :blk getAllWorkspaces(bun.default_allocator, manager) catch bun.outOfMemory();
|
||||
break :blk bun.handleOom(getAllWorkspaces(bun.default_allocator, manager));
|
||||
} else blk: {
|
||||
const root_pkg_id = manager.root_package_id.get(manager.lockfile, manager.workspace_name_hash);
|
||||
if (root_pkg_id == invalid_package_id) return;
|
||||
|
||||
const ids = bun.default_allocator.alloc(PackageID, 1) catch bun.outOfMemory();
|
||||
const ids = bun.handleOom(bun.default_allocator.alloc(PackageID, 1));
|
||||
ids[0] = root_pkg_id;
|
||||
break :blk ids;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user