Simplify toplevel error handling.

This commit is contained in:
r-vdp 2023-04-07 11:28:57 +02:00
parent 0424edf5fb
commit 903655cb52
No known key found for this signature in database

View file

@ -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