diff options
Diffstat (limited to 'src/9p_io.zig')
| -rw-r--r-- | src/9p_io.zig | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/9p_io.zig b/src/9p_io.zig index d1b2099c..5a68238c 100644 --- a/src/9p_io.zig +++ b/src/9p_io.zig @@ -1808,7 +1808,17 @@ pub const Client = struct { var sock_buf: [sun_path_len]u8 = undefined; const sock = try resolve(&sock_buf, dial); var remote: RemoteError = .{}; - return fetchBytes(gpa, sock, names[0..n], &remote, null, display_path, @min(max_bytes, limits.max_file_bytes)); + return fetchBytes(gpa, sock, names[0..n], &remote, null, display_path, @min(max_bytes, limits.max_file_bytes)) catch |err| { + if (err == error.Remote) said = remote; + return err; + }; + } + + /// The peer's own words for the last error.Remote a read or write here + /// got (its Rerror), for a caller that says why. + var said: RemoteError = .{}; + pub fn lastSaid() []const u8 { + return said.buf[0..said.len]; } /// Whether a peer answers at `dial`: a version and attach, and its root @@ -1828,7 +1838,10 @@ pub const Client = struct { var sock_buf: [sun_path_len]u8 = undefined; const sock = try resolve(&sock_buf, dial); var remote: RemoteError = .{}; - const result = try fetchBytes(gpa, sock, names[0..n], &remote, bytes, path, limits.max_file_bytes); + const result = fetchBytes(gpa, sock, names[0..n], &remote, bytes, path, limits.max_file_bytes) catch |err| { + if (err == error.Remote) said = remote; + return err; + }; gpa.free(result); } |
