Include a warning to devs for unhandled exceptions
The same situation will cause a crash on at least macOS.
This commit is contained in:
committed by
Yorik van Havre
parent
127d16eacc
commit
de294dabca
@@ -75,6 +75,16 @@ bool GUIApplication::notify (QObject * receiver, QEvent * event)
|
||||
(int)event->type());
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://github.com/FreeCAD/FreeCAD/issues/16905
|
||||
std::string exceptionWarning =
|
||||
#if FC_DEBUG
|
||||
"Exceptions must be caught before they go through Qt."
|
||||
" Ignoring this will cause crashes on some systems.\n";
|
||||
#else
|
||||
"";
|
||||
#endif
|
||||
|
||||
try {
|
||||
if (event->type() == Spaceball::ButtonEvent::ButtonEventType ||
|
||||
event->type() == Spaceball::MotionEvent::MotionEventType)
|
||||
@@ -89,14 +99,15 @@ bool GUIApplication::notify (QObject * receiver, QEvent * event)
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Unhandled Base::Exception caught in GUIApplication::notify.\n"
|
||||
"The error message is: %s\n", e.what());
|
||||
"The error message is: %s\n%s", e.what(), exceptionWarning);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
Base::Console().Error("Unhandled std::exception caught in GUIApplication::notify.\n"
|
||||
"The error message is: %s\n", e.what());
|
||||
"The error message is: %s\n%s", e.what(), exceptionWarning);
|
||||
}
|
||||
catch (...) {
|
||||
Base::Console().Error("Unhandled unknown exception caught in GUIApplication::notify.\n");
|
||||
Base::Console().Error("Unhandled unknown exception caught in GUIApplication::notify.\n%s",
|
||||
exceptionWarning);
|
||||
}
|
||||
|
||||
// Print some more information to the log file (if active) to ease bug fixing
|
||||
|
||||
Reference in New Issue
Block a user