mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 13:51:47 +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:
@@ -33,7 +33,7 @@ pub const DeferredRepeatingTask = *const (fn (*anyopaque) bool);
|
||||
map: std.AutoArrayHashMapUnmanaged(?*anyopaque, DeferredRepeatingTask) = .{},
|
||||
|
||||
pub fn postTask(this: *DeferredTaskQueue, ctx: ?*anyopaque, task: DeferredRepeatingTask) bool {
|
||||
const existing = this.map.getOrPutValue(bun.default_allocator, ctx, task) catch bun.outOfMemory();
|
||||
const existing = bun.handleOom(this.map.getOrPutValue(bun.default_allocator, ctx, task));
|
||||
return existing.found_existing;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user