From 1a53b0e6e40b22dfd81aecefd821b4d21e07a5d8 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 13 Jan 2019 15:58:05 -0800 Subject: [PATCH] ircd::ctx: Improve exception handling at base frame. --- ircd/ctx.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ircd/ctx.cc b/ircd/ctx.cc index 7edb3387c..5ed680b1f 100644 --- a/ircd/ctx.cc +++ b/ircd/ctx.cc @@ -109,11 +109,11 @@ noexcept try } catch(const ircd::ctx::interrupted &) { - return; + } catch(const ircd::ctx::terminated &) { - return; + } catch(const std::exception &e) { @@ -124,14 +124,15 @@ catch(const std::exception &e) id, e.what() }; - - // Preserving the stacktrace from the throw point here is hopeless. - // We can terminate for developer nuisance but we will never know - // where this exception came from and where it is going. Bottom line - // is that #ifdef'ing away this handler or rethrowing isn't as useful as - // handling the exception here with a log message and calling it a day. - assert(0); - return; +} +catch(...) +{ + log::critical + { + "ctx('%s' id:%u): unexpected", + name, + id + }; } /// Direct context switch to this context.