From 84c8209d02f6830db861c3a8dde0c710c88075f0 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 9 Nov 2026 03:29:30 -0300 Subject: idioms: the edit surface fails by name: the undo history (Journal.mark, Text.remember and step, File's, terminal's and edit's pushUndo and undoStep) returns error{OutOfMemory} instead of dropping an undo point, setEditText, enterInsert and insertTab return edit.Error with try where they reported each failure, Registers.put and setYank return error{OutOfMemory} instead of losing a yank, and their other-file callers decide (try under edit.Error, said on the pane by Undo, Redo, Pipe, Edit, Query, keys, look, completion, Incl and Plumb, ENOMEM or null where a 9P write answers, Ask's false); ctl.get and getFile return GetError (fs.ReadError, now named at fs.zig's surface, and InvalidName) for the *anyerror out-parameter and errno, the 9P get, Get and Edit's e mapping it as before; the OOM undo test pins the error; perf.zig's try relabels its harness hash, the three baselines re-keyed to it (their numbers the base's) Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/fs.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/fs.zig') diff --git a/src/fs.zig b/src/fs.zig index a0092991..d90bb8c0 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -457,11 +457,15 @@ fn resolveVirtual(p: ?*pardes.Pardes, path: []const u8, out: *[4096]u8) ?Resolve return null; } -pub fn read(p: *pardes.Pardes, path: []const u8) ![]u8 { +/// What reading a file through the namespace fails with: the disk's, a +/// peer's (Client.readMount), the served tree's. +pub const ReadError = error{ Timeout, WriteFailed, PermissionDenied, FileNotFound, ReadFailed, OutOfMemory, Dial, BadDial, FileTooLarge, NodeCollision, TooManyFiles, OpenFailed, NotAFile, PathTooLong, IsDirectory, PathTooDeep, Hangup, Botch, Remote, NotFound }; + +pub fn read(p: *pardes.Pardes, path: []const u8) ReadError![]u8 { return readLimit(p, path, limits.max_file_bytes); } -pub fn readLimit(p: *pardes.Pardes, path: []const u8, max_bytes: usize) ![]u8 { +pub fn readLimit(p: *pardes.Pardes, path: []const u8, max_bytes: usize) ReadError![]u8 { const limit = @min(max_bytes, limits.max_file_bytes); if (std.mem.eql(u8, std.mem.trimEnd(u8, path, "/"), "/n")) { var out: std.Io.Writer.Allocating = .init(p.gpa); -- cgit v1.3