Commit f687f9ef authored by Dick Hollenbeck's avatar Dick Hollenbeck

catch some IO_ERRORs

parent 5efdac01
...@@ -226,6 +226,30 @@ struct APP_SINGLE_TOP : public wxApp ...@@ -226,6 +226,30 @@ struct APP_SINGLE_TOP : public wxApp
return wxApp::OnExit(); return wxApp::OnExit();
} }
int OnRun() // overload wxApp virtual
{
try
{
return wxApp::OnRun();
}
catch( const std::exception& e )
{
wxLogError( "Unhandled exception class: %s what: %s",
typeid(e).name(), e.what() );
}
catch( const IO_ERROR& ioe )
{
wxLogError( "Unhandled exception class: %s what: %s",
typeid( ioe ).name(), TO_UTF8( ioe.errorText ) );
}
catch(...)
{
wxLogError( "Unhandled exception of unknown type" );
}
return -1;
}
/** /**
* Function MacOpenFile * Function MacOpenFile
* is specific to MacOSX (not used under Linux or Windows). * is specific to MacOSX (not used under Linux or Windows).
......
...@@ -119,6 +119,20 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) ...@@ -119,6 +119,20 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
} }
#if 0
/*
This code block was based on two major assumptions that are no longer true:
1) Footprint library basenames would remain the same.
(But no, basenames have been renamed in the github repo.)
2) *.mod files would still be around and merely reside in the FP_LIB_TABLE.
(But no, they have been converted to *.pretty.)
There is a newer replacement code block in the #else region.
*/
/** /**
* Function missingLegacyLibs * Function missingLegacyLibs
* tests the list of \a aLibNames by URI to determine if any of them are missing from * tests the list of \a aLibNames by URI to determine if any of them are missing from
...@@ -171,21 +185,6 @@ static bool missingLegacyLibs( FP_LIB_TABLE* aTbl, SEARCH_STACK& aSStack, ...@@ -171,21 +185,6 @@ static bool missingLegacyLibs( FP_LIB_TABLE* aTbl, SEARCH_STACK& aSStack,
} }
#if 0
/*
This code block was based on two major assumptions that are no longer true:
1) Footprint library basenames would remain the same.
(But no, basenames have been renamed in the github repo.)
2) *.mod files would still be around and merely reside in the FP_LIB_TABLE.
(But no, they have been converted to *.pretty.)
There is a newer replacement code block in the #else region.
*/
/** /**
* Function convertFromLegacy * Function convertFromLegacy
* converts the footprint names in \a aNetList from the legacy format to the #FPID format. * converts the footprint names in \a aNetList from the legacy format to the #FPID format.
...@@ -460,7 +459,6 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles() ...@@ -460,7 +459,6 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
#else // new strategy #else // new strategy
/// Return true if the resultant FPID has a certain nickname. The guess /// Return true if the resultant FPID has a certain nickname. The guess
/// is only made if this footprint resides in only one library. /// is only made if this footprint resides in only one library.
/// @return int - 0 on success, 1 on not found, 2 on ambiguous i.e. multiple matches /// @return int - 0 on success, 1 on not found, 2 on ambiguous i.e. multiple matches
...@@ -548,40 +546,52 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles() ...@@ -548,40 +546,52 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
{ {
msg.Clear(); msg.Clear();
for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) try
{ {
COMPONENT* component = m_netlist.GetComponent( i ); for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
if( component->GetFPID().IsLegacy() )
{ {
int guess = guessNickname( tbl, (FPID*) &component->GetFPID() ); COMPONENT* component = m_netlist.GetComponent( i );
switch( guess ) if( component->GetFPID().IsLegacy() )
{ {
case 0: int guess = guessNickname( tbl, (FPID*) &component->GetFPID() );
DBG(printf("%s: guessed OK ref:%s fpid:%s\n", __func__,
TO_UTF8( component->GetReference() ), component->GetFPID().Format().c_str() );) switch( guess )
m_modified = true; {
break; case 0:
DBG(printf("%s: guessed OK ref:%s fpid:%s\n", __func__,
case 1: TO_UTF8( component->GetReference() ), component->GetFPID().Format().c_str() );)
msg += wxString::Format( _( m_modified = true;
"Component '%s' footprint '%s' was <b>not found</b> in any library.\n" ), break;
GetChars( component->GetReference() ),
GetChars( component->GetFPID().GetFootprintName() ) case 1:
); msg += wxString::Format( _(
break; "Component '%s' footprint '%s' was <b>not found</b> in any library.\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetFPID().GetFootprintName() )
);
break;
case 2: case 2:
msg += wxString::Format( _( msg += wxString::Format( _(
"Component '%s' footprint '%s' was found in <b>multiple</b> libraries.\n" ), "Component '%s' footprint '%s' was found in <b>multiple</b> libraries.\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetFPID().GetFootprintName() ) GetChars( component->GetFPID().GetFootprintName() )
); );
break; break;
}
} }
} }
} }
catch( const IO_ERROR& ioe )
{
wxString msg = ioe.errorText;
msg += wxT( "\n\n" );
msg += _( "First check your fp-lib-table entries." );
wxMessageBox( msg, wxT( "Problematic fp-lib-tables" ) );
return false;
}
if( msg.size() ) if( msg.size() )
{ {
...@@ -593,7 +603,13 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles() ...@@ -593,7 +603,13 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
dlg.MessageSet( wxT( "\nYou will need to reassign them manually if you want them " dlg.MessageSet( wxT( "\nYou will need to reassign them manually if you want them "
"to be updated correctly the next time you import the " "to be updated correctly the next time you import the "
"netlist in Pcbnew." ) ); "netlist in Pcbnew." ) );
#if 1
dlg.ShowModal(); dlg.ShowModal();
#else
dlg.Fit();
dlg.Show( true ); // modeless lets user watch while fixing the problems, but its not working.
#endif
} }
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment