summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/cmdentry.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-11 08:52:01 +0300
committerPaul Buetow <paul@buetow.org>2026-06-11 08:52:01 +0300
commitece7dcfd232b780f5650326c8ac2379ca70387d4 (patch)
treef4e09717b535fe6e277269e70deff40a60147a36 /internal/hexaiaction/cmdentry.go
parenta5bd7dd1eb63a2be332ecda50fbeccfe5d5de0a8 (diff)
Fix error wrapping: use %w for primary child error in tmux action
In runInTmuxChild, the primary failure is the child runFn error; the echo-through failure is secondary context. Wrap the primary error with %w (keeping copyErr as %v, since fmt.Errorf allows only one %w) so errors.Is/As work across the chain. Audited all other fmt.Errorf %v/%s sites in internal/ and cmd/: they format strings, ints, status codes, or an []error aggregate (syncer), none of which is a single primary error to unwrap, so they stay as-is. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'internal/hexaiaction/cmdentry.go')
-rw-r--r--internal/hexaiaction/cmdentry.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/hexaiaction/cmdentry.go b/internal/hexaiaction/cmdentry.go
index ee78307..85e9059 100644
--- a/internal/hexaiaction/cmdentry.go
+++ b/internal/hexaiaction/cmdentry.go
@@ -91,7 +91,10 @@ func runChild(ctx context.Context, infile, outfile string, stdout, stderr io.Wri
if err := runFn(ctx, in, out, stderr); err != nil {
closeOut()
if copyErr := echoThrough(infile, tmp, os.Stdin, stdout); copyErr != nil {
- return fmt.Errorf("hexai-tmux-action child: %v; echo failed: %v", err, copyErr)
+ // Wrap the primary child error with %w so callers can inspect it
+ // via errors.Is/As; the echo failure is secondary context and
+ // stays as %v (fmt.Errorf supports only a single %w).
+ return fmt.Errorf("hexai-tmux-action child: %w; echo failed: %v", err, copyErr)
}
} else {
closeOut()