From 98d2f25af2d224468fefba69b4b78dadf170ee55 Mon Sep 17 00:00:00 2001 From: Daniel Seiler Date: Sat, 30 Dec 2023 08:04:26 +0100 Subject: [PATCH] feat: get & print std::current_exception (#1366) --- dCommon/Diagnostics.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dCommon/Diagnostics.cpp b/dCommon/Diagnostics.cpp index 2dd4a850..a4055086 100644 --- a/dCommon/Diagnostics.cpp +++ b/dCommon/Diagnostics.cpp @@ -115,6 +115,13 @@ void GenerateDump() { } 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__ std::string fileName = Diagnostics::GetOutDirectory() + "crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";