summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 452f6174..c2bde804 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -5105,6 +5105,20 @@ pub const Pardes = struct {
p.fs.late_failure_len = @intCast(kept.len);
}
+ /// A Dump the host could not write: said on the message row and in the
+ /// log, and the 9P write that asked for it fails with it, as a failed
+ /// Save's does.
+ pub fn dumpFailed(p: *Pardes, path: []const u8, err: anyerror) void {
+ var what: [limits.host_path_cap + 8]u8 = undefined;
+ const operation = std.fmt.bufPrint(&what, "Dump {s}", .{path}) catch "Dump";
+ p.reportError(p.active, operation, err);
+ var buf: [256]u8 = undefined;
+ const said = std.fmt.bufPrint(&buf, "{s}: {s}", .{ operation, @errorName(err) }) catch "Dump failed";
+ const kept = @import("Messages.zig").clip(said, p.fs.late_failure.len);
+ @memcpy(p.fs.late_failure[0..kept.len], kept);
+ p.fs.late_failure_len = @intCast(kept.len);
+ }
+
/// The path a watch is about: a real file's, or a PDF's.
fn watchPath(p: *const Pardes, id: u8) ?[]const u8 {
const pane = p.panes[id] orelse return null;