From d97de297afbd06e068ace20baa1869a4b2635ad8 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Wed, 19 Apr 2023 21:17:31 -0400 Subject: [PATCH] Move 3 more blocks to the common ex handler --- common/kiway.cpp | 11 +---------- kicad/kicad_cli.cpp | 22 ++-------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/common/kiway.cpp b/common/kiway.cpp index 54774a2de6..b0ad92cce0 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -452,18 +452,9 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow m_playerFrameId[aFrameType].store( frame->GetId() ); return frame; } - catch( const IO_ERROR& ioe ) - { - wxLogError( ioe.What() ); - wxLogError( _( "Error loading editor." ) ); - } - catch( const std::exception& e ) - { - wxLogError( e.what() ); - wxLogError( _( "Error loading editor." ) ); - } catch( ... ) { + Pgm().HandleException( std::current_exception() ); wxLogError( _( "Error loading editor." ) ); } } diff --git a/kicad/kicad_cli.cpp b/kicad/kicad_cli.cpp index 38845f7145..1c3005aeac 100644 --- a/kicad/kicad_cli.cpp +++ b/kicad/kicad_cli.cpp @@ -479,18 +479,9 @@ struct APP_KICAD_CLI : public wxAppConsole { return program.OnPgmRun(); } - catch( const std::exception& e ) - { - wxLogError( wxT( "Unhandled exception class: %s what: %s" ), - FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) ); - } - catch( const IO_ERROR& ioe ) - { - wxFprintf( stderr, ioe.What() ); - } catch( ... ) { - wxLogError( wxT( "Unhandled exception of unknown type" ) ); + Pgm().HandleException( std::current_exception() ); } return -1; @@ -560,18 +551,9 @@ struct APP_KICAD_CLI : public wxAppConsole { throw; } - catch( const std::exception& e ) - { - wxLogError( "Unhandled exception class: %s what: %s", FROM_UTF8( typeid( e ).name() ), - FROM_UTF8( e.what() ) ); - } - catch( const IO_ERROR& ioe ) - { - wxLogError( ioe.What() ); - } catch( ... ) { - wxLogError( "Unhandled exception of unknown type" ); + Pgm().HandleException( std::current_exception() ); } return false; // continue on. Return false to abort program