22#include <wx/translation.h>
29 return wxString( wxS(
"IO_ERROR: " ) ) +
Problem() + wxS(
"\n\n" ) +
Where();
49 const char* aThrowersFunction,
int aThrowersLineNumber )
55 wxString srcname = aThrowersFile;
59 where.Printf( wxS(
"from %s : %s() line %d" ),
60 srcname.AfterLast(
'/' ),
61 wxString( aThrowersFunction ),
62 aThrowersLineNumber );
68 return problem.utf8_str().data();
73 const wxString& aProblem ) :
74 IO_ERROR( aProblem.IsEmpty() ?
_(
"Canceled by user." ) : aProblem, aThrowersFile, aThrowersFunction,
81 const char* aThrowersFunction,
int aThrowersLineNumber,
82 const wxString& aSource,
const char* aInputLine,
int aLineNumber,
87 problem.Printf(
_(
"%s in '%s', line %d, offset %d." ),
99 wxString srcname = aThrowersFile;
103 where.Printf( wxS(
"from %s : %s() line %d" ),
104 srcname.AfterLast(
'/' ),
105 wxString( aThrowersFunction ),
106 aThrowersLineNumber );
111 const wxString& aRequiredGenerator )
118 problem.Printf(
_(
"KiCad was unable to open this file because it was created with a more "
119 "recent version than the one you are running.\n\n"
120 "To open it you will need to upgrade KiCad to a version dated %s or "
126 problem.Printf(
_(
"KiCad was unable to open this file because it was created with a more "
127 "recent version than the one you are running.\n\n"
128 "To open it you will need to upgrade KiCad to version %s or "
129 "later (file format dated %s or later)." ),
130 aRequiredGenerator, aRequiredVersion );
136 const wxString& aRequiredGenerator ) :
139 init( aRequiredVersion, aRequiredGenerator );
147 const wxString& aRequiredVersion,
148 const wxString& aRequiredGenerator ) :
159 init( aRequiredVersion, aRequiredGenerator );
161 if( !aParseError.
Problem().IsEmpty() )
162 problem += wxS(
"\n\n" ) +
_(
"Full error text:" ) + wxS(
"\n" ) +
IO_CANCELLED(const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber, const wxString &aProblem=wxEmptyString)
Normally thrown via the macro THROW_IO_CANCELLED(), which supplies the call-site file,...
void init(const wxString &aProblem, const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber)
virtual const wxString What() const
A composite of Problem() and Where()
IO_ERROR(const wxString &aProblem, const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber)
Use macro THROW_IO_ERROR() to wrap a call to this constructor at the call site.
virtual const wxString Problem() const
what was the problem?
virtual const char * what() const override
std::exception interface, returned as UTF-8
virtual const wxString Where() const
where did the Problem() occur?
int lineNumber
at which line number, 1 based index.
std::string inputLine
problem line of input [say, from a LINE_READER].
PARSE_ERROR(const wxString &aProblem, const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber, const wxString &aSource, const char *aInputLine, int aLineNumber, int aByteIndex)
Normally called via the macro THROW_PARSE_ERROR so that FILE, FUNCTION, and LINE can be captured from...
int byteIndex
at which byte offset within the line, 1 based index
void init(const wxString &aProblem, const char *aThrowersFile, const char *aThrowersFunction, int aThrowersLineNumber, const wxString &aSource, const char *aInputLine, int aLineNumber, int aByteIndex)