From ee19a40bef0ae419b6b727c6b2172890b62d8e93 Mon Sep 17 00:00:00 2001 From: Kyle Bloom Date: Wed, 27 Sep 2023 14:01:30 +0100 Subject: [PATCH] Catch standard exceptions on unexpected exit (#7282) * Catch standard exceptions on unexpected exit * Update changelog --- ChangeLog | 1 + src/lib/mt/Thread.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8d41de97..2fac191b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ Enhancements: - #7269 Change file drag drop ERROR to DEBUG message - #7274 Support env var to build unified core binary - #7277 Change all errors that cause crash are FATAL +- #7282 Improve error handling for thread jobs - #7284 Change session ID info log message to DEBUG2 CI changes: diff --git a/src/lib/mt/Thread.cpp b/src/lib/mt/Thread.cpp index 9016906c0..4bfe1fe49 100644 --- a/src/lib/mt/Thread.cpp +++ b/src/lib/mt/Thread.cpp @@ -23,6 +23,7 @@ #include "arch/Arch.h" #include "base/Log.h" #include "base/IJob.h" +#include // // Thread @@ -169,12 +170,17 @@ Thread::threadFunc(void* vjob) LOG((CLOG_DEBUG1 "caught exit on thread 0x%08x, result %p", id, result)); } catch (XBase& e) { - LOG((CLOG_ERR "exception on thread 0x%08x: %s", id, e.what())); + LOG((CLOG_ERR "synergy exception on thread 0x%08x: %s", id, e.what())); + delete job; + throw; + } + catch (std::exception& e) { + LOG((CLOG_ERR "standard exception on thread 0x%08x: %s", id, e.what())); delete job; throw; } catch (...) { - LOG((CLOG_ERR "exception on thread 0x%08x: ", id)); + LOG((CLOG_ERR "non-exception throw on thread 0x%08x: ", id)); delete job; throw; }