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