mu: log warning when exiting with error

This commit is contained in:
Dirk-Jan C. Binnema 2023-09-23 09:26:08 +03:00
parent 3dad743e16
commit 11003000e8
2 changed files with 7 additions and 1 deletions

View File

@ -189,7 +189,10 @@ private:
static inline auto
format_as(const Error& err) {
return mu_format("<{} ({})>", err.what(), Error::error_number(err.code()));
return mu_format("<{} ({}:{})>",
err.what(),
Error::error_number(err.code()),
err.exit_code());
}
} // namespace Mu

View File

@ -67,6 +67,9 @@ handle_result(const Result<void>& res, const Mu::Options& opts)
col.fg(Color::Blue), col.reset(),
col.fg(Color::Green), res.error().hint(), col.reset());
if (res.error().exit_code() != 0 && !res.error().is_soft_error())
mu_warning("mu finishing with error: {}", format_as(res.error()));
return res.error().exit_code();
}