Implement OnUnhandledException and point to sentry
Some "crashes" are just unhandled exceptions that may not get logged to sentry otherwise. (though they should through WER but it doesnt seem to always work)
This commit is contained in:
+13
-1
@@ -805,7 +805,7 @@ bool PGM_BASE::IsGUI()
|
||||
}
|
||||
|
||||
|
||||
void PGM_BASE::HandleException( std::exception_ptr aPtr )
|
||||
void PGM_BASE::HandleException( std::exception_ptr aPtr, bool aUnhandled )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -815,6 +815,12 @@ void PGM_BASE::HandleException( std::exception_ptr aPtr )
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxLogError( ioe.What() );
|
||||
|
||||
if( aUnhandled )
|
||||
{
|
||||
// Log this IO_ERROR escaped our usual uses (bad)
|
||||
APP_MONITOR::SENTRY::Instance()->LogException( ioe.What() );
|
||||
}
|
||||
}
|
||||
catch( const std::exception& e )
|
||||
{
|
||||
@@ -825,7 +831,13 @@ void PGM_BASE::HandleException( std::exception_ptr aPtr )
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// We really shouldn't have these but just in case...
|
||||
wxLogError( wxT( "Unhandled exception of unknown type" ) );
|
||||
|
||||
if( aUnhandled )
|
||||
{
|
||||
APP_MONITOR::SENTRY::Instance()->LogException( "Unhandled exception of unknown type" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <kiway.h>
|
||||
#include <build_version.h>
|
||||
#include <pgm_base.h>
|
||||
#include <app_monitor.h>
|
||||
#include <kiway_player.h>
|
||||
#include <macros.h>
|
||||
#include <confirm.h>
|
||||
@@ -278,6 +279,11 @@ struct APP_SINGLE_TOP : public wxApp
|
||||
return Event_Skip;
|
||||
}
|
||||
|
||||
void OnUnhandledException() override
|
||||
{
|
||||
Pgm().HandleException( std::current_exception(), true );
|
||||
}
|
||||
|
||||
#if defined( DEBUG )
|
||||
/**
|
||||
* Override main loop exception handling on debug builds.
|
||||
|
||||
+1
-1
@@ -321,7 +321,7 @@ public:
|
||||
*
|
||||
* @param aPtr Pass the std::current_exception() from within the catch block.
|
||||
*/
|
||||
void HandleException( std::exception_ptr aPtr );
|
||||
void HandleException( std::exception_ptr aPtr, bool aUnhandled = false );
|
||||
|
||||
/**
|
||||
* A common assert handler to be used between single_top and kicad.
|
||||
|
||||
+10
-2
@@ -511,7 +511,7 @@ struct APP_KICAD : public wxApp
|
||||
return true;
|
||||
}
|
||||
|
||||
int OnExit() override
|
||||
int OnExit() override
|
||||
{
|
||||
program.OnPgmExit();
|
||||
|
||||
@@ -521,7 +521,8 @@ struct APP_KICAD : public wxApp
|
||||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
int OnRun() override
|
||||
|
||||
int OnRun() override
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -535,6 +536,13 @@ struct APP_KICAD : public wxApp
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void OnUnhandledException() override
|
||||
{
|
||||
Pgm().HandleException( std::current_exception(), true );
|
||||
}
|
||||
|
||||
|
||||
int FilterEvent( wxEvent& aEvent ) override
|
||||
{
|
||||
if( aEvent.GetEventType() == wxEVT_SHOW )
|
||||
|
||||
Reference in New Issue
Block a user