fix: add a better error message for fetch when it fails with an unknown code (#9663)

* add a better error message for fetch when it fails with an unknown code

* Update src/bun.js/webcore/response.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* [autofix.ci] apply automated fixes

* fix compilation

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
dave caruso
2024-03-29 14:18:11 -07:00
committed by GitHub
parent e80e61c9a3
commit 3047c9005e
3 changed files with 49 additions and 1 deletions

View File

@@ -397,6 +397,14 @@ pub const String = extern struct {
return BunString__fromUTF16(bytes.ptr, bytes.len);
}
pub fn createFormat(comptime fmt: []const u8, args: anytype) !String {
var sba = std.heap.stackFallback(16384, bun.default_allocator);
const alloc = sba.get();
const buf = try std.fmt.allocPrint(alloc, fmt, args);
defer alloc.free(buf);
return createUTF8(buf);
}
pub fn createFromOSPath(os_path: bun.OSPathSlice) String {
return switch (@TypeOf(os_path)) {
[]const u8 => createUTF8(os_path),