From 2a8145ba4007f448d05ca8bd71f137f058a45555 Mon Sep 17 00:00:00 2001 From: Xiphoseer Date: Fri, 29 Dec 2023 23:07:49 +0100 Subject: [PATCH] feat: get & print std::current_exception --- dCommon/Diagnostics.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dCommon/Diagnostics.cpp b/dCommon/Diagnostics.cpp index 2dd4a8501..a40550863 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";