mirror of https://github.com/djcb/mu.git
mu: log warning when exiting with error
This commit is contained in:
parent
3dad743e16
commit
11003000e8
|
@ -189,7 +189,10 @@ private:
|
||||||
|
|
||||||
static inline auto
|
static inline auto
|
||||||
format_as(const Error& err) {
|
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
|
} // namespace Mu
|
||||||
|
|
3
mu/mu.cc
3
mu/mu.cc
|
@ -67,6 +67,9 @@ handle_result(const Result<void>& res, const Mu::Options& opts)
|
||||||
col.fg(Color::Blue), col.reset(),
|
col.fg(Color::Blue), col.reset(),
|
||||||
col.fg(Color::Green), res.error().hint(), 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();
|
return res.error().exit_code();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue