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 {
|
fn handle_toplevel_error<T>(r: Result<T>) -> ExitCode {
|
||||||
if let Err(e) = r {
|
if r.is_err() {
|
||||||
let out: String = itertools::intersperse(
|
log::error!("{:?}", r);
|
||||||
e.chain().map(ToString::to_string),
|
|
||||||
"\nCaused by:\n ".to_owned(),
|
|
||||||
)
|
|
||||||
.collect();
|
|
||||||
log::error!("{out}");
|
|
||||||
return ExitCode::FAILURE;
|
return ExitCode::FAILURE;
|
||||||
}
|
}
|
||||||
ExitCode::SUCCESS
|
ExitCode::SUCCESS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue