diff options
Diffstat (limited to 'src/Messages.zig')
| -rw-r--r-- | src/Messages.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Messages.zig b/src/Messages.zig index 8b6c795d..7d284e6b 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -445,10 +445,22 @@ pub fn messageLog(m: *const Messages, i: usize) ?*const LoggedMessage { } /// `<operation>: <the error in words>`: FileNotFound reads "file not found". +/// What a route that would open a pane says when every slot is taken. +pub const no_pane_slots = "no pane slots: {d} max"; + pub fn reportError(p: *Pardes, id: usize, operation: []const u8, err: anyerror) void { var buf: [256]u8 = undefined; var w = std.Io.Writer.fixed(&buf); w.print("{s}: ", .{operation}) catch {}; + // Every route that opens a pane says the cap the same way. + if (err == error.NoPaneSlots) { + w.print(no_pane_slots, .{pardes.MAX_PANES}) catch {}; + // A 9P look or exec that would open the pane fails with it too. + p.fs.no_pane_slot = true; + @memcpy(p.fs.ename[0..w.buffered().len], w.buffered()); + p.fs.no_pane_slot_len = @intCast(w.buffered().len); + return reportFailure(p, id, w.buffered()); + } for (@errorName(err), 0..) |c, i| { if (std.ascii.isUpper(c) and i > 0) w.writeByte(' ') catch break; w.writeByte(std.ascii.toLower(c)) catch break; |
