Skip to content

fix(cli): show user-friendly error messages instead of debug output#129

Merged
sachiniyer merged 1 commit intomainfrom
fix/verbose-error-output
Mar 6, 2026
Merged

fix(cli): show user-friendly error messages instead of debug output#129
sachiniyer merged 1 commit intomainfrom
fix/verbose-error-output

Conversation

@sachiniyer
Copy link
Copy Markdown
Contributor

@sachiniyer sachiniyer commented Mar 6, 2026

Summary

  • Errors from main() were displayed using anyhow's default Debug formatting, exposing verbose internal details (HTTP headers, struct dumps, error chains)
  • Handle errors explicitly in main() and print only the user-facing message using {} formatting (outermost context only)
  • Return ExitCode instead of Result<()>

Fixes #126

Detail Bug

bug_4482bdd4-0926-480e-a6e8-9a5658a54f48

Test plan

  • Run detail auth login --token <invalid> and verify error message is concise
  • Verify exit code is non-zero on error

🤖 Generated with Claude Code


Open with Devin

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

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>
@sachiniyer sachiniyer force-pushed the fix/verbose-error-output branch from 5efd462 to 66668ca Compare March 6, 2026 11:43
@sachiniyer sachiniyer marked this pull request as ready for review March 6, 2026 11:48
@sachiniyer sachiniyer merged commit 92044b7 into main Mar 6, 2026
12 checks passed
@sachiniyer sachiniyer deleted the fix/verbose-error-output branch March 6, 2026 11:48
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment thread src/main.rs
match detail_cli::Cli::parse().run().await {
Ok(()) => ExitCode::SUCCESS,
Err(err) => {
let _ = Term::stderr().write_line(&format!("Error: {}", err));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Suggested change
let _ = Term::stderr().write_line(&format!("Error: {}", err));
let _ = Term::stderr().write_line(&format!("Error: {:#}", err));
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

sachiniyer added a commit that referenced this pull request Mar 12, 2026
## 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>
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.

[Detail Bug] CLI: Error output includes verbose internal details (HTTP headers, struct dumps)

1 participant