Skip to content

Commit

Permalink
Change error formatting to omit backtraces
Browse files Browse the repository at this point in the history
The format specifier we use for printing errors returned by the main
program will include a backtrace in the output -- if one is available.
That's not necessarily a feature that we need: the causal chain of
errors should be sufficient and end users are unlikely to have use for a
backtrace.
This change adjusts the format specifier so that we only print the chain
of errors, albeit in a slightly different format:
- Previously:
  > Failed to generate OTP
  >
  > Caused by:
  >     Command error: The given slot is not programmed

- New:
  > Failed to generate OTP: Command error: The given slot is not programmed
  • Loading branch information
d-e-s-o committed Apr 17, 2021
1 parent 0338cd2 commit a723eb2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Unreleased
----------
- Enabled usage of empty PWS slot fields
- Changed error reporting format to make up only a single line
- Added `NITROCLI_RESOLVED_USB_PATH` environment variable to be used by
extensions
- Allowed entering of `base32` encoded strings containing spaces
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ fn evaluate_err(err: anyhow::Error, stderr: &mut dyn io::Write) -> i32 {
if let Some(err) = err.root_cause().downcast_ref::<DirectExitError>() {
err.0
} else {
let _ = writeln!(stderr, "{:?}", err);
let _ = writeln!(stderr, "{:#}", err);
1
}
}
Expand Down

0 comments on commit a723eb2

Please sign in to comment.