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:
pfg
2025-10-02 14:11:29 -07:00
committed by GitHub
parent d7eebef6f8
commit 2caa5dc8f2
8 changed files with 29 additions and 25 deletions

View File

@@ -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);
}