summaryrefslogtreecommitdiff
path: root/src/Pipe.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Pipe.zig')
-rw-r--r--src/Pipe.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Pipe.zig b/src/Pipe.zig
index e7895c0d..87768f22 100644
--- a/src/Pipe.zig
+++ b/src/Pipe.zig
@@ -103,7 +103,7 @@ pub fn submitPipe(p: *Pardes, id: usize) void {
const f = pane.file orelse return;
if (!panes.Output.fileTraits(f.output).saves) return;
}
- const content = edit.flatSurface(p, t) catch return;
+ const content = edit.flatSurface(p, t) catch |err| return p.reportError(id, "pipe", err);
const how = switch (pane.prompt) {
.pipe => |pipe| pipe,
else => return,
@@ -174,11 +174,11 @@ fn pipeFailed(p: *Pardes, wait: *const PendingPipe, failure: ?selection_pipe.Fai
var out: std.Io.Writer.Allocating = .init(p.gpa);
defer out.deinit();
const w = &out.writer;
- w.print("| {s}\n\n", .{wait.command}) catch return;
+ w.print("| {s}\n\n", .{wait.command}) catch |err| return p.reportError(wait.pane, "pipe", err);
if (wait.inputs.len > 1) if (failure) |fail|
- w.print("selection {d} of {d}: ", .{ fail.index + 1, wait.inputs.len }) catch return;
- writeFailure(w, failure) catch return;
- const content = out.toOwnedSlice() catch return;
+ w.print("selection {d} of {d}: ", .{ fail.index + 1, wait.inputs.len }) catch |err| return p.reportError(wait.pane, "pipe", err);
+ writeFailure(w, failure) catch |err| return p.reportError(wait.pane, "pipe", err);
+ const content = out.toOwnedSlice() catch |err| return p.reportError(wait.pane, "pipe", err);
const was = p.view().active;
panes.Output.openErrors(p, wait.pane, content) catch |err| {
p.gpa.free(content);
@@ -191,7 +191,7 @@ fn pipeFailed(p: *Pardes, wait: *const PendingPipe, failure: ?selection_pipe.Fai
/// How a filter failed, a line, and the command's stderr after it: what
/// +Errors says of a `|` and of an Edit's `< | >`.
-pub fn writeFailure(w: *std.Io.Writer, failure: ?selection_pipe.Failure) !void {
+pub fn writeFailure(w: *std.Io.Writer, failure: ?selection_pipe.Failure) std.Io.Writer.Error!void {
const fail = failure orelse {
// No diagnosis at all: nobody ran it. The detached daemon leaves
// `pipe` null on purpose.
@@ -267,7 +267,7 @@ pub fn pipeResponse(
.workspace => &p.global_tag,
.input => return,
};
- const content = edit.flatSurface(p, t) catch return;
+ const content = edit.flatSurface(p, t) catch |err| return p.reportError(wait.pane, "pipe", err);
const changed = if (t.what == .body) changed: {
const f = pane.file orelse return;
if (!panes.Output.fileTraits(f.output).saves) return;
@@ -301,12 +301,12 @@ pub fn pipeResponse(
const cut = pipeCut(&wait, content, i) orelse return;
const output = pipeOutput(&wait, outputs, content, i);
if (output.len > selection_pipe.max_stdout_bytes) return;
- total_output = std.math.add(usize, total_output, output.len) catch return;
+ total_output = std.math.add(usize, total_output, output.len) catch unreachable; // both are capped far below a usize's room
if (total_output > selection_pipe.max_total_stdout_bytes) return;
if (i > 0 and cut.lo < ops[i - 1].q1) return;
ops[i] = .{ .q0 = @intCast(cut.lo), .q1 = @intCast(cut.hi), .text = output };
}
- const replacement = sam.apply(p.gpa, content, ops[0..n]) catch return;
+ const replacement = sam.apply(p.gpa, content, ops[0..n]) catch |err| return p.reportError(wait.pane, "pipe", err);
var new_ranges: [panes.Text.max_selections]modal.Selection = undefined;
var delta: isize = 0;
for (ops[0..n], wait.ranges[0..n], new_ranges[0..n]) |op, range, *moved| {