diff --git a/lib/std/http/Client.zig b/lib/std/http/Client.zig index 7cf512d65fd0b299e1900151ed2bdc3eec88313a..7f62b2d5977f26a71361ce210341a33e8bda147b 100644 --- a/lib/std/http/Client.zig +++ b/lib/std/http/Client.zig @@ -658,6 +658,7 @@ pub const Request = struct { MissingEndCertificateMarker, InvalidPadding, EndOfStream, + InvalidArgument, }; pub fn read(req: *Request, buffer: []u8) ReadError!usize { diff --git a/lib/std/os.zig b/lib/std/os.zig index f2bd8bda97eb6285f459205bac503dfd5c7c09da..821c544cc88d8869dcbf534ba36d3800db72c1ae 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -1027,6 +1027,7 @@ pub const WriteError = error{ InputOutput, NoSpaceLeft, DeviceBusy, + InvalidArgument, /// In WASI, this error may occur when the file descriptor does /// not hold the required rights to write to it. @@ -1113,7 +1114,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { switch (errno(rc)) { .SUCCESS => return @intCast(usize, rc), .INTR => continue, - .INVAL => unreachable, + .INVAL => return error.InvalidArgument, .FAULT => unreachable, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForWriting, // can be a race condition. @@ -1183,7 +1184,7 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize { switch (errno(rc)) { .SUCCESS => return @intCast(usize, rc), .INTR => continue, - .INVAL => unreachable, + .INVAL => return error.InvalidArgument, .FAULT => unreachable, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForWriting, // Can be a race condition. @@ -1278,7 +1279,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { switch (errno(rc)) { .SUCCESS => return @intCast(usize, rc), .INTR => continue, - .INVAL => unreachable, + .INVAL => return error.InvalidArgument, .FAULT => unreachable, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForWriting, // Can be a race condition. @@ -1368,7 +1369,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz switch (errno(rc)) { .SUCCESS => return @intCast(usize, rc), .INTR => continue, - .INVAL => unreachable, + .INVAL => return error.InvalidArgument, .FAULT => unreachable, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForWriting, // Can be a race condition. diff --git a/src/link.zig b/src/link.zig index 24cc0a3861e01b0c595994335c0ce4fa87b48130..1ecbeadd7f92af26712659001084292191f538d2 100644 --- a/src/link.zig +++ b/src/link.zig @@ -461,6 +461,7 @@ pub const File = struct { LockViolation, NetNameDeleted, DeviceBusy, + InvalidArgument, }; /// Called from within the CodeGen to lower a local variable instantion as an unnamed diff --git a/src/main.zig b/src/main.zig index fb02628c618b1a7c435c1630a59af77d2682c3b1..b134b7183e23f6e4f6f06b37522aec74cca2e087 100644 --- a/src/main.zig +++ b/src/main.zig @@ -4622,6 +4622,7 @@ const FmtError = error{ ConnectionResetByPeer, LockViolation, NetNameDeleted, + InvalidArgument, } || fs.File.OpenError; fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: fs.Dir, sub_path: []const u8) FmtError!void {