Improve error handling when reading test board data
This commit is contained in:
parent
3c0566d318
commit
11be5d6f1d
|
@ -106,6 +106,12 @@ std::unique_ptr<BOARD> ReadBoardFromFileOrStream( const std::string& aFilename,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
file_stream.open( aFilename );
|
file_stream.open( aFilename );
|
||||||
|
|
||||||
|
if( !file_stream.is_open() )
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
in_stream = &file_stream;
|
in_stream = &file_stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +133,12 @@ std::unique_ptr<FOOTPRINT> ReadFootprintFromFileOrStream( const std::string& aFi
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
file_stream.open( aFilename );
|
file_stream.open( aFilename );
|
||||||
|
|
||||||
|
if( !file_stream.is_open() )
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
in_stream = &file_stream;
|
in_stream = &file_stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,17 @@ void LoadBoard( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath,
|
||||||
else if( legacyProject.Exists() )
|
else if( legacyProject.Exists() )
|
||||||
aSettingsManager.LoadProject( legacyProject.GetFullPath() );
|
aSettingsManager.LoadProject( legacyProject.GetFullPath() );
|
||||||
|
|
||||||
|
BOOST_TEST_MESSAGE( "Loading board file: " << boardPath );
|
||||||
|
|
||||||
|
try {
|
||||||
aBoard = ReadBoardFromFileOrStream( boardPath );
|
aBoard = ReadBoardFromFileOrStream( boardPath );
|
||||||
|
}
|
||||||
|
catch( const IO_ERROR& ioe )
|
||||||
|
{
|
||||||
|
BOOST_TEST_ERROR( ioe.What() );
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_REQUIRE( aBoard );
|
||||||
|
|
||||||
if( projectFile.Exists() || legacyProject.Exists() )
|
if( projectFile.Exists() || legacyProject.Exists() )
|
||||||
aBoard->SetProject( &aSettingsManager.Prj() );
|
aBoard->SetProject( &aSettingsManager.Prj() );
|
||||||
|
|
Loading…
Reference in New Issue