Merge pull request #542 from vadz/unhandled-except

Improve user-visible message about unhandled exception.
This commit is contained in:
VZ
2017-08-28 19:48:02 +02:00
committed by GitHub

View File

@@ -673,7 +673,6 @@ void wxAppConsoleBase::CallEventHandler(wxEvtHandler *handler,
void wxAppConsoleBase::OnUnhandledException() void wxAppConsoleBase::OnUnhandledException()
{ {
#ifdef __WXDEBUG__
// we're called from an exception handler so we can re-throw the exception // we're called from an exception handler so we can re-throw the exception
// to recover its type // to recover its type
wxString what; wxString what;
@@ -685,9 +684,9 @@ void wxAppConsoleBase::OnUnhandledException()
catch ( std::exception& e ) catch ( std::exception& e )
{ {
#ifdef wxNO_RTTI #ifdef wxNO_RTTI
what.Printf("std::exception, what() = \"%s\"", e.what()); what.Printf("standard exception with message \"%s\"", e.what());
#else #else
what.Printf("std::exception of type \"%s\", what() = \"%s\"", what.Printf("standard exception of type \"%s\" with message \"%s\"",
typeid(e).name(), e.what()); typeid(e).name(), e.what());
#endif #endif
} }
@@ -698,9 +697,10 @@ void wxAppConsoleBase::OnUnhandledException()
} }
wxMessageOutputBest().Printf( wxMessageOutputBest().Printf(
"*** Caught unhandled %s; terminating\n", what "Unhandled %s; terminating %s.\n",
what,
wxIsMainThread() ? "the application" : "the thread in which it happened"
); );
#endif // __WXDEBUG__
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------