diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 24d32a1e07..f373b6fc4e 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -68,12 +68,14 @@ FP_LIB_TABLE::FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable ) : void FP_LIB_TABLE::Parse( LIB_TABLE_LEXER* in ) { T tok; + wxString errMsg; // to collect error messages // This table may be nested within a larger s-expression, or not. // Allow for parser of that optional containing s-epression to have looked ahead. if( in->CurTok() != T_fp_lib_table ) { in->NeedLEFT(); + if( ( tok = in->NextTok() ) != T_fp_lib_table ) in->Expecting( T_fp_lib_table ); } @@ -88,10 +90,6 @@ void FP_LIB_TABLE::Parse( LIB_TABLE_LEXER* in ) if( tok != T_LEFT ) in->Expecting( T_LEFT ); - // in case there is a "row integrity" error, tell where later. - int lineNum = in->CurLineNumber(); - int offset = in->CurOffset(); - if( ( tok = in->NextTok() ) != T_lib ) in->Expecting( T_lib ); @@ -175,14 +173,22 @@ void FP_LIB_TABLE::Parse( LIB_TABLE_LEXER* in ) // use doReplace in InsertRow(). (However a fallBack table can have a // conflicting nickName and ours will supercede that one since in // FindLib() we search this table before any fall back.) + wxString nickname = row->GetNickName(); // store it to be able to used it + // after row deletion if an error occurs if( !InsertRow( row.release() ) ) { wxString msg = wxString::Format( _( "'%s' is a duplicate footprint library nickName" ), - GetChars( row->GetNickName() ) ); - THROW_PARSE_ERROR( msg, in->CurSource(), in->CurLine(), lineNum, offset ); + GetChars( nickname ) ); + if( !errMsg.IsEmpty() ) + errMsg << '\n'; + + errMsg << msg; } } + + if( !errMsg.IsEmpty() ) + THROW_IO_ERROR( errMsg ); } diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 1b41451ee6..bb4209642c 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -264,12 +264,16 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) } catch( const IO_ERROR& ioe ) { + // if we are here, a incorrect global symbol library table was found. + // Incorrect global symbol library table is not a fatal error: + // the user just has to edit the (partially) loaded table. wxString msg = wxString::Format( _( - "An error occurred attempting to load the global symbol library table:\n\n%s" ), + "An error occurred attempting to load the global symbol library table:" + "\n\n%s\n\n" + "Please edit this global symbol library table in Preferences menu" ), GetChars( ioe.What() ) ); DisplayError( NULL, msg ); - return false; } return true; diff --git a/eeschema/symbol_lib_table.cpp b/eeschema/symbol_lib_table.cpp index 5ed55651e4..19d4dc2ce7 100644 --- a/eeschema/symbol_lib_table.cpp +++ b/eeschema/symbol_lib_table.cpp @@ -185,11 +185,13 @@ void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in ) // use doReplace in InsertRow(). (However a fallBack table can have a // conflicting nickName and ours will supercede that one since in // FindLib() we search this table before any fall back.) + wxString nickname = row->GetNickName(); // store it to be able to used it + // after row deletion if an error occurs if( !InsertRow( row.release() ) ) { wxString msg = wxString::Format( _( "'%s' is a duplicate symbol library nickname" ), - GetChars( row->GetNickName() ) ); + GetChars( nickname ) ); THROW_PARSE_ERROR( msg, in->CurSource(), in->CurLine(), lineNum, offset ); } } diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 4df333f8d4..84b6edd229 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -354,13 +354,16 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) } catch( const IO_ERROR& ioe ) { + // if we are here, a incorrect global footprint library table was found. + // Incorrect global footprint library table is not a fatal error: + // the user just has to edit the (partially) loaded table. wxString msg = wxString::Format( _( "An error occurred attempting to load the global footprint library " - "table:\n\n%s" ), + "table:\n\n%s\n\n" + "Please edit this global footprint library table in Preferences menu" ), GetChars( ioe.What() ) ); DisplayError( NULL, msg ); - return false; } #if defined(KICAD_SCRIPTING)