mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 19:08:50 +00:00
Passthrough anyerror when using handleOom (#23176)
### What does this PR do? Previously, handleOom(anyerror!T) would return T and panic for OutOfMemory for any error. fixes it to return anyerror!T for this case. ### How did you verify your code works? CI --------- Co-authored-by: taylor.fish <contact@taylor.fish>
This commit is contained in:
@@ -352,7 +352,7 @@ pub fn Printer(comptime Writer: type) type {
|
||||
pub fn writeFmt(this: *This, comptime fmt: []const u8, args: anytype) PrintErr!void {
|
||||
// assuming the writer comes from an ArrayList
|
||||
const start: usize = getWrittenAmt(this.dest);
|
||||
bun.handleOom(this.dest.print(fmt, args));
|
||||
this.dest.print(fmt, args) catch return this.addFmtError();
|
||||
const written = getWrittenAmt(this.dest) - start;
|
||||
this.col += @intCast(written);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user