From 12b7bf1c16f671c83840961c37a339141a7ffbb3 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 4 Apr 2024 14:32:40 +0200 Subject: improved assert (#37) - Improvement: Add file and line to ASSERT exceptions - Improvement: Catch call stack when throwing assert exceptions and log/output call stack at important places to provide more context to caller --- src/zencore/workthreadpool.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/zencore/workthreadpool.cpp') diff --git a/src/zencore/workthreadpool.cpp b/src/zencore/workthreadpool.cpp index 16b2310ff..f41c13bf6 100644 --- a/src/zencore/workthreadpool.cpp +++ b/src/zencore/workthreadpool.cpp @@ -186,7 +186,13 @@ WorkerThreadPool::Impl::WorkerThreadFunction(ThreadStartInfo Info) ZEN_TRACE_CPU_FLUSH("AsyncWork"); Work->Execute(); } - catch (std::exception& e) + catch (const AssertException& Ex) + { + Work->m_Exception = std::current_exception(); + + ZEN_WARN("Assert exception in worker thread: {}", Ex.FullDescription()); + } + catch (const std::exception& e) { Work->m_Exception = std::current_exception(); @@ -234,7 +240,13 @@ WorkerThreadPool::ScheduleWork(Ref Work) ZEN_TRACE_CPU_FLUSH("SyncWork"); Work->Execute(); } - catch (std::exception& e) + catch (const AssertException& Ex) + { + Work->m_Exception = std::current_exception(); + + ZEN_WARN("Assert exception in worker thread: {}", Ex.FullDescription()); + } + catch (const std::exception& e) { Work->m_Exception = std::current_exception(); -- cgit v1.2.3