Skip to content

fix: show friendly error messages on more failure paths - #98

Merged
deveshctl merged 1 commit into
mainfrom
fix/error-message-polish
Aug 7, 2026
Merged

fix: show friendly error messages on more failure paths#98
deveshctl merged 1 commit into
mainfrom
fix/error-message-polish

Conversation

@deveshctl

Copy link
Copy Markdown
Owner

Summary

Several failure paths surfaced raw internal error strings instead of the clear, actionable messages the rest of the tool already produced. This polishes three of them and keeps the exit-code contract documented.

User-visible changes

  • No container engine reachable. Running layerx <image> with no Docker/Podman available — or with a Podman connection that is unconfigured, missing, or malformed — now prints the same friendly, actionable message the other commands already showed, instead of a raw internal error string with no recovery hint.
  • Archive read failures. The interactive viewer's "could not …" archive error no longer suggests freeing disk space or setting TMPDIR for failures that are not disk-full (for example a seek or I/O error on a network mount). The disk-space hint now appears only when the underlying cause is actually a full disk, matching the command-line behaviour.
  • JSON export on a full disk. --json now reports a clean no space left to write <path> message that names the output file you specified, instead of leaking the internal temporary spool file path.

Notes

  • No new features and no behaviour changes beyond the wording of these error messages. Exit codes are unchanged — failing paths still return the same error, so scripts relying on exit status are unaffected.
  • Added unit tests covering the disk-full vs non-disk-full branches for both the archive-infra message and the JSON write path.

Testing

  • go build ./... and go vet ./... clean.
  • New unit tests pass in CI.
  • Recommend a manual pass: trigger a no-engine run, a non-disk-full archive read failure, and a full-disk --json export, and confirm each message reads clearly.

Several failure paths surfaced raw internal error strings to the user
instead of the actionable messages the rest of the tool already produced.

- Interactive `layerx <image>`: engine/resolver selection failures (no
  engine reachable, Podman connection unconfigured or malformed) are
  produced before the TUI starts and were returned bare, so the user saw
  the raw Error() string with no recovery hint. Route them through the
  same friendly presenter the --json path already uses, and silence
  cobra's default printer so nothing double-prints. The error is returned
  unchanged so the process exit code is unaffected.

- Interactive viewer: the archive "could not ..." message unconditionally
  told the user to free disk space / set TMPDIR, even for seek and I/O
  failures (e.g. on a network mount) that have nothing to do with a full
  disk. Gate the hint on the disk-full cause, matching the CLI.

- JSON export: a full disk leaked the internal temporary spool file path
  into the user-facing error. Rewrite the disk-full case to name the
  output path the user supplied instead.

Also document why unrecognised and usage errors exit 2 in main.go, so the
distinction from rule/build failures is not accidentally collapsed later.
@deveshctl
deveshctl merged commit e82cf32 into main Aug 7, 2026
21 of 24 checks passed
@deveshctl
deveshctl deleted the fix/error-message-polish branch August 7, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant