mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 11:59:00 +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:
@@ -1701,7 +1701,7 @@ pub const CreateCommand = struct {
|
||||
const extension = std.fs.path.extension(positional);
|
||||
if (Example.Tag.fromFileExtension(extension)) |tag| {
|
||||
example_tag = tag;
|
||||
break :brk bun.default_allocator.dupe(u8, outdir_path) catch bun.outOfMemory();
|
||||
break :brk bun.handleOom(bun.default_allocator.dupe(u8, outdir_path));
|
||||
}
|
||||
// Show a warning when the local file exists and it's not a .js file
|
||||
// A lot of create-* npm packages have .js in the name, so you could end up with that warning.
|
||||
|
||||
Reference in New Issue
Block a user