Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
use anyhow::Result;
use clap::Parser;
use console::Term;
use std::process::ExitCode;

#[tokio::main]
async fn main() -> Result<()> {
detail_cli::Cli::parse().run().await
async fn main() -> ExitCode {
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.

ExitCode::FAILURE
}
}
}