feat: get & print std::current_exception (#1366)

This commit is contained in:
Daniel Seiler 2023-12-30 08:04:26 +01:00 committed by GitHub
parent dd9d94f75f
commit 98d2f25af2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,6 +115,13 @@ void GenerateDump() {
} }
void CatchUnhandled(int sig) { void CatchUnhandled(int sig) {
std::exception_ptr eptr = std::current_exception();
try {
if (eptr) std::rethrow_exception(eptr);
} catch(const std::exception& e) {
LOG("Caught exception: '%s'", e.what());
}
#ifndef __include_backtrace__ #ifndef __include_backtrace__
std::string fileName = Diagnostics::GetOutDirectory() + "crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log"; std::string fileName = Diagnostics::GetOutDirectory() + "crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";