diff --git a/common/kiway.cpp b/common/kiway.cpp index c5e432ca9b..8e5966506c 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -183,6 +183,24 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad ) // In any of the failure cases above, dso.Unload() should be called here // by dso destructor. + // However: + + // There is a file installation bug. We only look for KIFACE_I's which we know + // to exist, and we did not find one. If we do not find one, this is an + // installation bug. + + wxString msg = wxString::Format( wxT( + "Fatal Installation Bug\nmissing file:\n'%s'\n\nargv[0]:\n'%s'" ), + GetChars( dname ), + GetChars( wxStandardPaths::Get().GetExecutablePath() ) + ); + + // This is a fatal error, one from which we cannot recover, nor do we want + // to protect against in client code which would require numerous noisy + // tests in numerous places. So we inform the user that the installation + // is bad. This exception will likely not get caught until way up in + // PGM_BASE or a derivative, at which point the process will exit gracefully. + THROW_IO_ERROR( msg ); } return NULL; diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index ac0a734dc1..44e9488e56 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -280,6 +280,30 @@ struct APP_KICAD : public wxApp return wxApp::OnExit(); } + int OnRun() // overload wxApp virtual + { + try + { + return wxApp::OnRun(); + } + catch( const std::exception& e ) + { + wxLogError( wxT( "Unhandled exception class: %s what: %s" ), + GetChars( FROM_UTF8( typeid(e).name() )), + GetChars( FROM_UTF8( e.what() ) ) );; + } + catch( const IO_ERROR& ioe ) + { + wxLogError( GetChars( ioe.errorText ) ); + } + catch(...) + { + wxLogError( wxT( "Unhandled exception of unknown type" ) ); + } + + return -1; + } + /** * Function MacOpenFile * is specific to MacOSX (not used under Linux or Windows).