fix(cli): show user-friendly error messages instead of debug output#129
fix(cli): show user-friendly error messages instead of debug output#129sachiniyer merged 1 commit intomainfrom
Conversation
Errors from main() were displayed using anyhow's default Debug formatting,
exposing verbose internal details (HTTP headers, struct dumps). Handle errors
explicitly and print only the top-level message using Display formatting ({:#}).
Detail bug: bug_4482bdd4-0926-480e-a6e8-9a5658a54f48
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5efd462 to
66668ca
Compare
| match detail_cli::Cli::parse().run().await { | ||
| Ok(()) => ExitCode::SUCCESS, | ||
| Err(err) => { | ||
| let _ = Term::stderr().write_line(&format!("Error: {}", err)); |
There was a problem hiding this comment.
🟡 Error chain lost by using Display instead of Debug format for anyhow::Error
The previous code returned anyhow::Result<()> from main, which Rust formats using Debug ({:?}). For anyhow::Error, Debug prints the full chain of error causes (e.g., "Failed to fetch bug details: connection refused"). The new code uses format!("Error: {}", err) which invokes Display, and anyhow::Error's Display impl only prints the outermost error message, discarding the chain added via .context(). Since .context() is used extensively throughout the codebase (see src/commands/bugs.rs, src/config/storage.rs, src/api/client.rs, etc.), users will lose important diagnostic context when errors occur. The fix is to use {:?} or err.chain() to preserve the error chain, e.g., format!("Error: {:?}", err).
| let _ = Term::stderr().write_line(&format!("Error: {}", err)); | |
| let _ = Term::stderr().write_line(&format!("Error: {:#}", err)); |
Was this helpful? React with 👍 or 👎 to provide feedback.
## Summary - Bumps version from 0.1.10 to 0.1.11 - The release workflow will auto-tag and build artifacts when merged to main ### Changes since v0.1.10 **Features:** - Add shell tab completion via clap_complete (#182) - Add --scan-id flag to bugs list command (#184) - Add scans list command (#163) - Add scans to the skill.md for the detail CLI (#185) - Auto-detect repository in detail-bugs skill (#160) **Fixes:** - Show user-friendly error messages instead of debug output (#129) - Continue list numbering across pages instead of resetting (#130) - Add file locking to prevent concurrent config overwrites (#131) **Chores & Refactoring:** - Replace Makefile with cargo xtask (#159) - Upgrade all dependencies to latest versions (#158) - Enable comprehensive clippy lints (pedantic, nursery, restriction) (#134, #135, #144, #152, #153, #154, #155) - Add GitHub Pages workflow for API docs (#178) - Add Scalar API reference page (#177) - Add integration tests against live API (#181) - Remove alpha warning from README (#156) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

Summary
main()were displayed using anyhow's default Debug formatting, exposing verbose internal details (HTTP headers, struct dumps, error chains)main()and print only the user-facing message using{}formatting (outermost context only)ExitCodeinstead ofResult<()>Fixes #126
Detail Bug
bug_4482bdd4-0926-480e-a6e8-9a5658a54f48
Test plan
detail auth login --token <invalid>and verify error message is concise🤖 Generated with Claude Code