Sim: on parameters parsing error, give a better info than tao::pegtl::eof error.

This commit is contained in:
jean-pierre charras 2022-08-17 11:11:36 +02:00
parent adac433103
commit 34b38eb95b
1 changed files with 7 additions and 2 deletions

View File

@ -853,6 +853,8 @@ void SIM_MODEL::ReadSpiceCode( const wxString& aSpiceCode )
} }
catch( tao::pegtl::parse_error& e ) catch( tao::pegtl::parse_error& e )
{ {
wxString msg;
msg.Printf( _( "Error parsing spice code <%s>\n%s" ), aSpiceCode, e.what() );
THROW_IO_ERROR( e.what() ); THROW_IO_ERROR( e.what() );
} }
@ -1274,7 +1276,6 @@ wxString SIM_MODEL::GenerateParamsField( const wxString& aPairSeparator ) const
void SIM_MODEL::ParseParamsField( const wxString& aParamsField ) void SIM_MODEL::ParseParamsField( const wxString& aParamsField )
{ {
LOCALE_IO toggle; LOCALE_IO toggle;
tao::pegtl::string_input<> in( aParamsField.ToUTF8(), "Sim_Params" ); tao::pegtl::string_input<> in( aParamsField.ToUTF8(), "Sim_Params" );
std::unique_ptr<tao::pegtl::parse_tree::node> root; std::unique_ptr<tao::pegtl::parse_tree::node> root;
@ -1289,7 +1290,9 @@ void SIM_MODEL::ParseParamsField( const wxString& aParamsField )
} }
catch( const tao::pegtl::parse_error& e ) catch( const tao::pegtl::parse_error& e )
{ {
THROW_IO_ERROR( e.what() ); wxString msg;
msg.Printf( _( "Error parsing param <%s>\n%s" ), aParamsField, e.what() );
THROW_IO_ERROR( msg );
} }
wxString paramName = ""; wxString paramName = "";
@ -1344,6 +1347,8 @@ void SIM_MODEL::ParsePinsField( unsigned aSymbolPinCount, const wxString& aPinsF
} }
catch( const tao::pegtl::parse_error& e ) catch( const tao::pegtl::parse_error& e )
{ {
wxString msg;
msg.Printf( _( "Error parsing pin field <%s>\n%s" ), aPinsField, e.what() );
THROW_IO_ERROR( e.what() ); THROW_IO_ERROR( e.what() );
} }