Skip to content

fix(tui): friendly, consistently-coloured status-bar error messages - #99

Merged
deveshctl merged 2 commits into
mainfrom
fix/tui-error-polish
Aug 7, 2026
Merged

fix(tui): friendly, consistently-coloured status-bar error messages#99
deveshctl merged 2 commits into
mainfrom
fix/tui-error-polish

Conversation

@deveshctl

Copy link
Copy Markdown
Owner

Summary

Polishes the interactive TUI's error handling so failures show readable, actionable messages in the status bar — and always in the error colour.

Three status-bar failure paths previously surfaced raw internal error strings, and one failure was dropped silently:

  • Opening an unreadable file in the viewer (e.g. a file removed by a later layer, or a daemon that becomes unreachable mid-session) now shows a readable sentence instead of a raw internal error.
  • Saving an extracted file to a full disk now says "not enough disk space" and names only the file you chose, instead of leaking an internal temporary file path and a raw system error. Non-disk-full save errors also no longer leak that path.
  • A failed image-size lookup during loading is now surfaced as a brief status message instead of being silently dropped, so it no longer leaves the loading screen blank with no explanation.

Consistent error colour

The status bar previously picked its colour by checking whether the message began with the literal word "Error:". Because the friendlier messages above no longer start with that word, they would have rendered in the success (green) colour. The colour is now driven by intent — a flag set on failure and cleared on success — so every failure shown in the status bar renders in the error colour, and the five interactive guard messages ("cannot extract a directory", "file was removed in this layer", "extractor unavailable") are covered too.

Testing

  • go build ./... and go vet ./... clean.
  • Unit tests cover the new friendly-message helpers (disk-space wording, temp-path stripping, generic fallback), the inspect-failure surfacing across loading/ready/cancelled states, and the error-colour flag being set on failure and reset on clear.

The interactive viewer's status bar surfaced three failure paths as raw Go
error strings: opening a file that could not be read, saving an extracted
file, and (silently, in the size fetch) an inspect failure during loading.

- File-open and save-extract failures now route through the same friendly
  renderer the load path uses, so a mid-session daemon dropout or a removed
  file reads as a sentence instead of an internal error.
- Save write failures gate the disk-space hint on ENOSPC and name only the
  chosen file, so the internal temp-file path no longer leaks to the user.
- An image-size fetch that fails on its own during loading now shows a brief
  status warning instead of leaving the loading screen blank with no reason.
The status bar chose its colour by testing whether the message began
with the literal prefix 'Error:'. The friendlier viewer, save, and
inspect messages introduced alongside this no longer start with that
word, so they would have rendered in the success (green) colour.

Drive the colour from intent instead of the message text: a
statusIsError flag set by a dedicated setErrorStatus helper and cleared
by setStatus and on status expiry. All failure paths — the four async
result messages and the five interactive guards — now route through it,
so error voice and colour are consistent. Also strip the internal spool
path from save write errors that are not disk-full, matching the
disk-space path.
@deveshctl
deveshctl merged commit d4c2035 into main Aug 7, 2026
13 checks passed
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