From 2f23df8f5fc1252fc59b47ac099e98f88620fdae 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 00e9bc365e..f588e52ccd 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -455,18 +455,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 11b04b81b5..9d5351617d 100644 --- a/kicad/kicad_cli.cpp +++ b/kicad/kicad_cli.cpp @@ -494,18 +494,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; @@ -549,18 +540,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