Catch errors from `load()`

Loading footprints may throw in some cases.  We need to catch these
nicely without breaking out of the full loading process

Fixes https://gitlab.com/kicad/code/kicad/issues/10213

(cherry picked from commit 1874ad2f7e)
This commit is contained in:
Seth Hillbrand 2022-01-03 15:29:01 -08:00
parent ff38853886
commit 2a0e4a8324
1 changed files with 23 additions and 3 deletions

View File

@ -288,9 +288,29 @@ bool FOOTPRINT_LIST_IMPL::joinWorkers()
for( unsigned jj = 0; jj < fpnames.size() && !m_cancelled; ++jj )
{
wxString fpname = fpnames[jj];
FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO_IMPL( this, nickname, fpname );
queue_parsed.move_push( std::unique_ptr<FOOTPRINT_INFO>( fpinfo ) );
try
{
wxString fpname = fpnames[jj];
FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO_IMPL( this, nickname, fpname );
queue_parsed.move_push( std::unique_ptr<FOOTPRINT_INFO>( fpinfo ) );
}
catch( const IO_ERROR& ioe )
{
m_errors.move_push( std::make_unique<IO_ERROR>( ioe ) );
}
catch( const std::exception& se )
{
// This is a round about way to do this, but who knows what THROW_IO_ERROR()
// may be tricked out to do someday, keep it in the game.
try
{
THROW_IO_ERROR( se.what() );
}
catch( const IO_ERROR& ioe )
{
m_errors.move_push( std::make_unique<IO_ERROR>( ioe ) );
}
}
}
if( m_progress_reporter )