diff --git a/eeschema/sim/simulator_frame.cpp b/eeschema/sim/simulator_frame.cpp index 81dbe763ff..270e29647c 100644 --- a/eeschema/sim/simulator_frame.cpp +++ b/eeschema/sim/simulator_frame.cpp @@ -551,6 +551,7 @@ bool SIMULATOR_FRAME::LoadWorkbook( const wxString& aPath ) return true; } + DisplayErrorMessage( this, wxString::Format( _( "Unable to load or parse file %s" ), aPath ) ); return false; } diff --git a/eeschema/sim/simulator_frame_ui.cpp b/eeschema/sim/simulator_frame_ui.cpp index e9d15e0812..7e58158690 100644 --- a/eeschema/sim/simulator_frame_ui.cpp +++ b/eeschema/sim/simulator_frame_ui.cpp @@ -2109,6 +2109,29 @@ bool SIMULATOR_FRAME_UI::loadJsonWorkbook( const wxString& aPath ) return false; } + catch( nlohmann::json::type_error& error ) + { + wxLogTrace( traceSettings, wxT( "Json type error reading %s: %s" ), aPath, error.what() ); + + return false; + } + catch( nlohmann::json::invalid_iterator& error ) + { + wxLogTrace( traceSettings, wxT( "Json invalid_iterator error reading %s: %s" ), aPath, error.what() ); + + return false; + } + catch( nlohmann::json::out_of_range& error ) + { + wxLogTrace( traceSettings, wxT( "Json out_of_range error reading %s: %s" ), aPath, error.what() ); + + return false; + } + catch( ... ) + { + wxLogTrace( traceSettings, wxT( "Error reading %s" ), aPath ); + return false; + } return true; }