diff options
| author | Dan Engelbrecht <[email protected]> | 2024-04-04 14:32:40 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-04-04 14:32:40 +0200 |
| commit | 12b7bf1c16f671c83840961c37a339141a7ffbb3 (patch) | |
| tree | 3c503e6e1cd4d53b87c1baebcf9286ca8b72db06 /src/zencore/workthreadpool.cpp | |
| parent | hardening parsepackagemessage (#38) (diff) | |
| download | zen-12b7bf1c16f671c83840961c37a339141a7ffbb3.tar.xz zen-12b7bf1c16f671c83840961c37a339141a7ffbb3.zip | |
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
Diffstat (limited to 'src/zencore/workthreadpool.cpp')
| -rw-r--r-- | src/zencore/workthreadpool.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
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<IWork> 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(); |