Simplify toplevel error handling.
This commit is contained in:
parent
0424edf5fb
commit
903655cb52
1 changed files with 2 additions and 7 deletions
|
|
@ -294,13 +294,8 @@ fn check_root() -> Result<()> {
|
|||
}
|
||||
|
||||
fn handle_toplevel_error<T>(r: Result<T>) -> ExitCode {
|
||||
if let Err(e) = r {
|
||||
let out: String = itertools::intersperse(
|
||||
e.chain().map(ToString::to_string),
|
||||
"\nCaused by:\n ".to_owned(),
|
||||
)
|
||||
.collect();
|
||||
log::error!("{out}");
|
||||
if r.is_err() {
|
||||
log::error!("{:?}", r);
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
ExitCode::SUCCESS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue