Show in-app errors in the status bar instead of eprintln (#8) #27

Merged
eric merged 1 commit from eric/fix-8-eprintln-in-tui into master 2026-10-12 15:52:16 -05:00 AGit
Owner

Closes #8

Problem: errors inside the full-screen UI were printed with eprintln!. In full-screen mode they either vanished or wrote over the screen, so you never saw why something failed.

Fix: every eprintln! in src/handlers.rs that runs while the UI is up now sets status_message, and also logs the error where it wasn't logged already. That covers:

  • torrent search failure
  • saving episode details
  • resolving a video's path
  • loading details for the editor
  • toggling watched
  • clearing series data
  • deleting an episode
  • database and path errors in entry mode

Other changes:

  • Multi-line messages, like an error plus a "check your permissions" hint, are now one status line.
  • Per-file "skipping file" warnings during a scan or rescan go to the log only. The status bar adds "Skipped N files (see log)".
  • handle_edit_mode and handle_torrent_search_input now take status_message, and the torrent tests pass it.
  • Small related fix: "edit" from the menu used to switch to the editor before loading the episode, so a failed load left the editor open on stale data. It now switches only after a successful load.

Not changed:

  • Startup errors in main.rs still use eprintln!. They happen before the terminal is set up or after it's restored, which the issue says to keep.
  • "Failed to start video player" still prints, because that path returns an error that exits the app. That's #4, which is still in Backlog.
  • save_config in config.rs still prints its rare write-failure warning. I left config.rs alone to avoid conflicts with #24.

Testing:

  • Ran the app in tmux with the network blocked and ran a torrent search. Error: Search failed: … appeared in the status bar, the screen stayed intact, and nothing went to stderr.
  • Full suite: 207 passed, 2 failed. The failures are the timing test and the flaky logger test, both fixed in #25.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E2XefpQijvBcJBfgzuaoWA

Closes #8 **Problem:** errors inside the full-screen UI were printed with `eprintln!`. In full-screen mode they either vanished or wrote over the screen, so you never saw why something failed. **Fix:** every `eprintln!` in `src/handlers.rs` that runs while the UI is up now sets `status_message`, and also logs the error where it wasn't logged already. That covers: - torrent search failure - saving episode details - resolving a video's path - loading details for the editor - toggling watched - clearing series data - deleting an episode - database and path errors in entry mode Other changes: - Multi-line messages, like an error plus a "check your permissions" hint, are now one status line. - Per-file "skipping file" warnings during a scan or rescan go to the log only. The status bar adds "Skipped N files (see log)". - `handle_edit_mode` and `handle_torrent_search_input` now take `status_message`, and the torrent tests pass it. - Small related fix: "edit" from the menu used to switch to the editor before loading the episode, so a failed load left the editor open on stale data. It now switches only after a successful load. **Not changed:** - Startup errors in `main.rs` still use `eprintln!`. They happen before the terminal is set up or after it's restored, which the issue says to keep. - "Failed to start video player" still prints, because that path returns an error that exits the app. That's #4, which is still in Backlog. - `save_config` in `config.rs` still prints its rare write-failure warning. I left `config.rs` alone to avoid conflicts with #24. **Testing:** - Ran the app in tmux with the network blocked and ran a torrent search. `Error: Search failed: …` appeared in the status bar, the screen stayed intact, and nothing went to stderr. - Full suite: 207 passed, 2 failed. The failures are the timing test and the flaky logger test, both fixed in #25. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01E2XefpQijvBcJBfgzuaoWA
Failures inside the full-screen UI (torrent search, saving, path
resolution, toggling watched, clearing series data, deleting, loading
details, entry-mode database setup) were printed with eprintln!, which
either vanished or scribbled over the screen.

They now go to status_message, and to the log where they weren't
already. handle_edit_mode and handle_torrent_search_input take
status_message for this. Per-file "skipping" warnings during a scan or
rescan go to the log, with a "Skipped N files (see log)" count in the
status bar.

Opening the edit screen now happens only after the episode details
load, so a failed load no longer leaves the editor open on stale data.

Startup errors in main.rs still use eprintln!, since they happen
before the terminal is set up or after it's restored.

Closes #8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2XefpQijvBcJBfgzuaoWA
eric merged commit c9469cac52 into master 2026-10-12 15:52:16 -05:00
Sign in to join this conversation.
No reviewers
No labels
bug
chore
feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
spinach-dev/movies!27
No description provided.