From 511ff7e897305d37689ecc7b4e32646df8feff0e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mart=C3=ADn=20Ferrari?= Date: Sun, 27 Aug 2017 23:04:57 +0200 Subject: [PATCH] Demangling exception class name from error message of unknown exceptions. --- src/app/application.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/application.cpp b/src/app/application.cpp index e8ad62b..386b681 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -41,13 +41,17 @@ bool Application::notify(QObject* receiver, QEvent* event) error_message("UNCAUGHT exception: " + QString(e.what())); return false; } catch (...) { - error_message("UNCAUGHT exception: " + #if defined(__GNUC__) || defined(__llvm__) || defined(__clang__) - QString(__cxxabiv1::__cxa_current_exception_type()->name()) + int status = 0; + char *buff = __cxxabiv1::__cxa_demangle( + __cxxabiv1::__cxa_current_exception_type()->name(), + NULL, NULL, &status); + QString exception_name = QString(buff); + std::free(buff); #else - "unknown" + QString exception_name = QString("unknown"); #endif - ); + error_message("UNCAUGHT exception: " + exception_name); return false; } } -- 2.39.5