mirror of
https://github.com/Zygo/bees.git
synced 2025-05-18 05:45:45 +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>
This commit is contained in:
parent
f56f736d28
commit
59660cfc00
@ -51,7 +51,13 @@ thread_local BeesTracer *BeesTracer::tl_next_tracer = nullptr;
|
|||||||
BeesTracer::~BeesTracer()
|
BeesTracer::~BeesTracer()
|
||||||
{
|
{
|
||||||
if (uncaught_exception()) {
|
if (uncaught_exception()) {
|
||||||
|
try {
|
||||||
m_func();
|
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 ---");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user