SIMULATOR_FRAME_UI: catch all nlohmann::json::xxx errors.
Previously, only nlohmann::json::type_error was captured, and other errors were not handled, creating unhandled exception issue when reading broken *.wks files. Fixes https://gitlab.com/kicad/code/kicad/-/issues/18309
This commit is contained in:
parent
30dd8224be
commit
e2e95ec461
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue