mirror of https://github.com/djcb/mu.git
mu-cmd-server: report errors to mu4e
Even "existential errors" that cause mu-server not to start.
This commit is contained in:
parent
fd9cc6bcc4
commit
8a3a125ca3
|
@ -87,6 +87,17 @@ output_sexp_stdout (Sexp&& sexp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
report_error(const Mu::Error& err) noexcept
|
||||||
|
{
|
||||||
|
Sexp::List e;
|
||||||
|
|
||||||
|
e.add_prop(":error", Sexp::make_number(static_cast<size_t>(err.code())));
|
||||||
|
e.add_prop(":message", Sexp::make_string(err.what()));
|
||||||
|
|
||||||
|
output_sexp_stdout(Sexp::make_list(std::move(e)));
|
||||||
|
}
|
||||||
|
|
||||||
MuError
|
MuError
|
||||||
Mu::mu_cmd_server (const MuConfig *opts, GError **err) try {
|
Mu::mu_cmd_server (const MuConfig *opts, GError **err) try {
|
||||||
|
|
||||||
|
@ -130,9 +141,10 @@ Mu::mu_cmd_server (const MuConfig *opts, GError **err) try {
|
||||||
return MU_OK;
|
return MU_OK;
|
||||||
|
|
||||||
} catch (const Error& er) {
|
} catch (const Error& er) {
|
||||||
g_critical ("server caught exception: %s", er.what());
|
/* note: user-level error, "OK" for mu */
|
||||||
g_set_error(err, MU_ERROR_DOMAIN, MU_ERROR, "%s", er.what());
|
report_error(er);
|
||||||
return MU_ERROR;
|
g_warning ("server caught exception: %s", er.what());
|
||||||
|
return MU_OK;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
g_critical ("server caught exception");
|
g_critical ("server caught exception");
|
||||||
g_set_error(err, MU_ERROR_DOMAIN, MU_ERROR, "%s", "caught exception");
|
g_set_error(err, MU_ERROR_DOMAIN, MU_ERROR, "%s", "caught exception");
|
||||||
|
|
Loading…
Reference in New Issue