Be more verbose when finding an error
Try to give the user more information about what the actual file error is, rather than immediately throwing the IO_ERROR
This commit is contained in:
parent
3050b987ee
commit
c53fe1c1f0
|
@ -187,9 +187,20 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap, int aF
|
||||||
name = FromUTF8();
|
name = FromUTF8();
|
||||||
|
|
||||||
LIB_ID id;
|
LIB_ID id;
|
||||||
|
int bad_pos = id.Parse( name );
|
||||||
|
|
||||||
if( id.Parse( name ) >= 0 )
|
if( bad_pos >= 0 )
|
||||||
{
|
{
|
||||||
|
if( static_cast<int>( name.size() ) > bad_pos )
|
||||||
|
{
|
||||||
|
wxString msg = wxString::Format(
|
||||||
|
_( "Symbol %s contains invalid character '%c'" ), name,
|
||||||
|
name[bad_pos] );
|
||||||
|
|
||||||
|
THROW_PARSE_ERROR( msg, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
THROW_PARSE_ERROR( _( "Invalid library identifier" ), CurSource(), CurLine(),
|
THROW_PARSE_ERROR( _( "Invalid library identifier" ), CurSource(), CurLine(),
|
||||||
CurLineNumber(), CurOffset() );
|
CurLineNumber(), CurOffset() );
|
||||||
}
|
}
|
||||||
|
@ -2443,9 +2454,20 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
||||||
Expecting( "symbol|number" );
|
Expecting( "symbol|number" );
|
||||||
|
|
||||||
LIB_ID libId;
|
LIB_ID libId;
|
||||||
|
wxString name = FromUTF8();
|
||||||
|
int bad_pos = libId.Parse( name );
|
||||||
|
|
||||||
if( libId.Parse( FromUTF8() ) >= 0 )
|
if( bad_pos >= 0 )
|
||||||
{
|
{
|
||||||
|
if( static_cast<int>( name.size() ) > bad_pos )
|
||||||
|
{
|
||||||
|
wxString msg = wxString::Format(
|
||||||
|
_( "Symbol %s contains invalid character '%c'" ), name,
|
||||||
|
name[bad_pos] );
|
||||||
|
|
||||||
|
THROW_PARSE_ERROR( msg, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
||||||
|
}
|
||||||
|
|
||||||
THROW_PARSE_ERROR( _( "Invalid symbol library ID" ), CurSource(), CurLine(),
|
THROW_PARSE_ERROR( _( "Invalid symbol library ID" ), CurSource(), CurLine(),
|
||||||
CurLineNumber(), CurOffset() );
|
CurLineNumber(), CurOffset() );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue