Improved various error messages

- Moved developer "jargon" to details pane
- Changed error messages to "WHAT" rather than "WHY" or "WHERE"
This commit is contained in:
Oliver Walters 2017-07-21 00:06:41 +10:00 committed by Wayne Stambaugh
parent a0a3ca6646
commit c27f5b725d
17 changed files with 70 additions and 55 deletions

View File

@ -67,6 +67,7 @@ int DisplayExitDialog( wxWindow* parent, const wxString& aMessage )
}
// DisplayError should be deprecated, use DisplayErrorMessage instead
void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
{
wxMessageDialog* dialog;

View File

@ -76,7 +76,10 @@ int checkGlError( const std::string& aInfo, bool aThrow )
if( aThrow )
throw std::runtime_error( (const char*) errorMsg.char_str() );
else
DisplayError( nullptr, errorMsg );
DisplayErrorMessage(
nullptr,
_( "OpenGL error occurred" ),
errorMsg );
}
return result;

View File

@ -248,7 +248,7 @@ static bool copy_pro_file_template( const SEARCH_STACK& aSearchS, const wxString
"Unable to find '%s' template config file." ),
GetChars( templateFile ) );
DisplayError( NULL, msg );
DisplayErrorMessage( nullptr, _( "Error copying project file template" ), msg );
return false;
}
@ -412,7 +412,7 @@ FP_LIB_TABLE* PROJECT::PcbFootprintLibs( KIWAY& aKiway )
}
catch( const IO_ERROR& ioe )
{
DisplayError( NULL, ioe.What() );
DisplayErrorMessage( NULL, _( "Error loading project footprint library table" ), ioe.What() );
}
}

View File

@ -177,12 +177,10 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format( _(
"An error occurred attempting to load the global footprint library "
"table:\n\n%s" ),
GetChars( ioe.What() )
);
DisplayError( NULL, msg );
DisplayErrorMessage(
nullptr,
_( "An error occurred attempting to load the global footprint library table" ),
ioe.What() );
return false;
}

View File

@ -267,13 +267,12 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
// 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\n\n"
"Please edit this global symbol library table in Preferences menu" ),
GetChars( ioe.What() )
wxString msg = _(
"An error occurred attempting to load the global symbol library table.\n"
"Please edit this global symbol library table in Preferences menu"
);
DisplayError( NULL, msg );
DisplayErrorMessage( NULL, msg, ioe.What() );
}
return true;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@ -86,13 +86,11 @@ bool PCB_EDIT_FRAME::AppendBoardFile( const wxString& aFullFileName, int aCtl )
catch( const IO_ERROR& ioe )
{
for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() )
{
track->ClearFlags( FLAG0 );
}
wxString msg = wxString::Format( _(
"Error loading board.\n%s" ),
GetChars( ioe.What() )
);
DisplayError( this, msg );
DisplayErrorMessage( this, _( "Error loading board in AppendBoardFile" ), ioe.What() );
return false;
}

View File

@ -160,7 +160,9 @@ FP_LIB_TABLE* PROJECT::PcbFootprintLibs()
}
catch( const IO_ERROR& ioe )
{
DisplayError( NULL, ioe.What() );
DisplayErrorMessage( nullptr,
_( "Error loading project footprint libraries" ),
ioe.What() );
}
}

View File

@ -520,11 +520,9 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format( _(
"Error loading board.\n%s" ),
GetChars( ioe.What() )
);
DisplayError( this, msg );
DisplayErrorMessage( this,
wxString::Format( _( "Error loading board file:\n%s" ), fullFileName ),
ioe.What() );
return false;
}

View File

@ -544,7 +544,11 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
if( curr_item->Type() != PCB_LINE_T )
{
DisplayError( this, wxT( "curr_item Type error" ) );
DisplayErrorMessage(
this,
_( "Item type is incorrect" ),
wxString::Format( _( "Selected item type is %d\n"
"Expected: %d" ), curr_item->Type(), PCB_LINE_T ) );
m_canvas->SetAutoPanRequest( false );
break;
}

View File

@ -357,13 +357,13 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
// 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\n\n"
"Please edit this global footprint library table in Preferences menu" ),
GetChars( ioe.What() )
wxString msg = _(
"An error occurred attempting to load the global footprint library table:\n"
"Please edit this global footprint library table in Preferences menu"
);
DisplayError( NULL, msg );
DisplayErrorMessage( NULL, msg, ioe.What() );
}
#if defined(KICAD_SCRIPTING)

View File

@ -256,7 +256,11 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break;
default:
DisplayError( this, wxT( "PCB_EDIT_FRAME::Process_Config error" ) );
DisplayErrorMessage(
this,
_( "Unkown ID in Process Config" ),
wxString::Format( _( "PCB_EDIT_FRAME::Process_Config received ID %d" ), id ) );
break;
}
}

View File

@ -151,9 +151,9 @@ bool PCB_EDIT_FRAME::ExportSpecctraFile( const wxString& aFullFilename )
}
else
{
errorText += '\n';
errorText += _( "Unable to export, please fix and try again." );
DisplayError( this, errorText );
DisplayErrorMessage( this,
_( "Unable to export, please fix and try again" ),
errorText );
}
return ok;

View File

@ -85,9 +85,11 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
false );
if( fullFileName == wxEmptyString )
{
return;
}
SetCurItem( NULL );
SetCurItem( NULL );
// To avoid issues with undo/redo lists (dangling pointers)
// clear the lists
@ -104,13 +106,14 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
}
catch( const IO_ERROR& ioe )
{
wxString msg = ioe.What();
msg += '\n';
msg += _("BOARD may be corrupted, do not save it.");
msg += '\n';
msg += _("Fix problem and try again.");
wxString msg = _(
"Board may be corrupted, do not save it.\n"
"Fix problem and try again"
);
DisplayError( this, msg );
wxString extra = ioe.What();
DisplayErrorMessage( this, msg, extra);
return;
}
@ -129,7 +132,9 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
// add imported tracks (previous tracks are removed, therfore all are new)
for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() )
{
view->Add( track );
}
}
SetStatusText( wxString( _( "Session file imported and merged OK." ) ) );

View File

@ -101,7 +101,9 @@ void FOOTPRINT_EDIT_FRAME::ToolOnRightClick( wxCommandEvent& event )
break;
default:
DisplayError( this, wxT( "ToolOnRightClick() error" ) );
DisplayErrorMessage( this,
_( "Invalid tool ID "),
wxString::Format( _( "ToolOnRightClick called with ID %d" ), id ) );
break;
}
}

View File

@ -813,8 +813,9 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
default:
DisplayError( this,
wxT( "PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" ) );
DisplayErrorMessage( this,
_( "Invalid toolbar option" ),
_( "PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" ) );
break;
}
}

View File

@ -129,7 +129,7 @@ void PCB_EDIT_FRAME::duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone )
// do nothing
if( success && ( aZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
{
DisplayError( this,
DisplayErrorMessage( this,
_( "The duplicated zone cannot be on the same layer as the original zone." ) );
success = false;
}
@ -360,7 +360,7 @@ void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER*
if( error_count )
{
DisplayError( this, _( "Area: DRC outline error" ) );
DisplayErrorMessage( this, _( "Area: DRC outline error" ) );
}
}
@ -418,7 +418,7 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* aZone )
if( error_count )
{
DisplayError( this, _( "Area: DRC outline error" ) );
DisplayErrorMessage( this, _( "Area: DRC outline error" ) );
}
}
@ -532,7 +532,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
{
if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT && !IsCopperLayer( GetActiveLayer() ) )
{
DisplayError( this,
DisplayErrorMessage( this,
_( "Error: a keepout area is allowed only on copper layers" ) );
return 0;
}
@ -682,7 +682,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
// SCREEN::SetCurItem(), so the DRC error remains on screen.
// PCB_EDIT_FRAME::SetCurItem() calls DisplayInfo().
GetScreen()->SetCurItem( NULL );
DisplayError( this,
DisplayErrorMessage( this,
_( "DRC error: this start point is inside or too close an other area" ) );
return 0;
}
@ -747,7 +747,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
if( g_Drc_On && m_drc->Drc( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge
{
DisplayError( this,
DisplayErrorMessage( this,
_( "DRC error: closing this area creates a DRC error with an other area" ) );
m_canvas->MoveCursorToCrossHair();
return false;
@ -809,7 +809,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
if( error_count )
{
DisplayError( this, _( "Area: DRC outline error" ) );
DisplayErrorMessage( this, _( "Area: DRC outline error" ) );
}
UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() );