1
0
Mirror von https://github.com/tkuschel/bees.git synchronisiert 2026-06-19 06:57:54 +02:00

bees: handle trace functions that throw exceptions

A BEESTRACE closure could throw an exception.  Trap those so we don't
end up in terminate().

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
(cherry picked from commit 59660cfc00b9ca233eeb1a7cdf6df34a45a2deba)
Dieser Commit ist enthalten in:
Zygo Blaxell
2017-01-30 01:47:00 -05:00
Ursprung 8cde833863
Commit 74d256f0fe
+7 -1
Datei anzeigen
@@ -51,7 +51,13 @@ thread_local BeesTracer *BeesTracer::tl_next_tracer = nullptr;
BeesTracer::~BeesTracer() BeesTracer::~BeesTracer()
{ {
if (uncaught_exception()) { if (uncaught_exception()) {
m_func(); try {
m_func();
} catch (exception &e) {
BEESLOG("Nested exception: " << e.what());
} catch (...) {
BEESLOG("Nested exception ...");
}
if (!m_next_tracer) { if (!m_next_tracer) {
BEESLOG("--- END TRACE --- exception ---"); BEESLOG("--- END TRACE --- exception ---");
} }