fix: show friendly error messages on more failure paths - #98
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.TMPDIRfor 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.--jsonnow reports a cleanno space left to write <path>message that names the output file you specified, instead of leaking the internal temporary spool file path.Notes
Testing
go build ./...andgo vet ./...clean.--jsonexport, and confirm each message reads clearly.