Skip to content

Commit

Permalink
Catch standard exceptions on unexpected exit (symless#7282)
Browse files Browse the repository at this point in the history
* Catch standard exceptions on unexpected exit

* Update changelog
  • Loading branch information
aquacash5 committed Sep 27, 2023
1 parent 7d80307 commit ee19a40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 8 additions & 2 deletions src/lib/mt/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "arch/Arch.h"
#include "base/Log.h"
#include "base/IJob.h"
#include <exception>

//
// Thread
Expand Down Expand Up @@ -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: <unknown>", id));
LOG((CLOG_ERR "non-exception throw on thread 0x%08x: <unknown>", id));
delete job;
throw;
}
Expand Down

0 comments on commit ee19a40

Please sign in to comment.