diff --git a/lib/std/http/Client.zig b/lib/std/http/Client.zig index 7cf512d65f..7f62b2d597 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 f2bd8bda97..821c544cc8 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 24cc0a3861..1ecbeadd7f 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 fb02628c61..b134b7183e 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 {