27#ifndef __mxException__
28#define __mxException__
90 const std::string &emnem,
91 const std::string &efile,
93 const std::string &expl
104 const std::string &emnem,
106 const std::string &efile,
108 const std::string &expl
142 std::ostringstream s;
151 s <<
"\n code: " <<
m_code;
160 s <<
"\n in file: " <<
m_file;
162 s <<
"\n at line: " <<
m_line;
166 s <<
"\n " << strerror(
m_errno );
172 virtual const char *
what() const noexcept
186 const std::string &efile,
188 const std::string &expl
203 const std::string &esrc,
204 const std::string &efile,
206 const std::string &expl
221 const std::string &efile,
223 const std::string &expl
238 const std::string &efile,
240 const std::string &expl
255 const std::string &efile,
257 const std::string &expl
272 const std::string &efile,
274 const std::string &expl
289 const std::string &efile,
291 const std::string &expl
306 const std::string &efile,
308 const std::string &expl
315 const std::string &efile,
317 const std::string &expl
332 const std::string &efile,
334 const std::string &expl
341 const std::string &efile,
343 const std::string &expl
358 const std::string &efile,
360 const std::string &expl
367 const std::string &efile,
369 const std::string &expl
384 const std::string &efile,
386 const std::string &expl
393 const std::string &efile,
395 const std::string &expl
410 const std::string &efile,
412 const std::string &expl
427 const std::string &efile,
429 const std::string &expl
439#define mxThrowException( extype, src, expl ) throw extype( src, __FILE__, __LINE__, expl );
441#define mxThrowExceptionErrno( extype, en, src, expl ) throw extype( src, en, __FILE__, __LINE__, expl );
mxException for an allocation error
allocerr(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
mxException for an exception
exceptthrown(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
mxException for errors closing a file
filecerr(const std::string &esrc, const int &en, const std::string &efile, const int &line, const std::string &expl)
filecerr(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
mxException for errors on opening a file
fileoerr(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
fileoerr(const std::string &esrc, const int &en, const std::string &efile, const int &line, const std::string &expl)
mxException for errors reading from a file
filererr(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
filererr(const std::string &esrc, const int &en, const std::string &efile, const int &line, const std::string &expl)
mxException for errors writing to a file
filewerr(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
filewerr(const std::string &esrc, const int &en, const std::string &efile, const int &line, const std::string &expl)
mxException for invalid arguments
invalidarg(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
mxException for invalid config settings
invalidconfig(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
mxException for errors returned by a library call
liberr(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
The mxlib exception class.
std::string m_file
The source file where the exception originated.
std::string m_source
The source of the exception, such as stdlib or cfitisio or the function name.
mxException(const std::string &esrc, const int &ec, const std::string &emnem, const int &en, const std::string &efile, const int &line, const std::string &expl)
Construct and fill in each of the values, including errno.
mxException(const mxException &e) noexcept
Copy constructor.
mxException & operator=(const mxException &e) noexcept
Assignment operator.
int m_line
The line number of the file where the exception originated.
std::string m_codeName
The name of the error code.
char m_whatstr[4096]
Contains the what() string.
mxException(const std::string &esrc, const int &ec, const std::string &emnem, const std::string &efile, const int &line, const std::string &expl)
Construct and fill in each of the values, except errno.
virtual ~mxException()
Destructor.
int m_errno
The errno error code (only used if non-zero)
std::string m_explanation
The long explanation of the error.
int m_code
The mxlib error code.
virtual const char * what() const noexcept
Return the details of the exception as a single string.
virtual void build_what()
Build the what string.
mxException() noexcept
Default constructor.
mxException for not found
notfound(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
mxException for not implemented features
notimpl(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
mxException for parameters which aren't set
paramnotset(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
mxException for a size error
sizeerr(const std::string &esrc, const std::string &efile, const int &line, const std::string &expl)
std::string errno_CodeToName(int ec)
Return the macro name and a message for a standard errno code.
#define MXE_EXCEPTTHROWN
An exception was thrown.
#define MXE_FILERERR
An error occurred while reading from a file.
#define MXE_INVALIDCONFIG
A config setting was invalid.
#define MXE_INVALIDARG
An argument was invalid.
#define MXE_LIBERR
An error was returned by a library.
#define MXE_ALLOCERR
An error occurred during memory allocation.
#define MXE_SIZEERR
A size was invalid or calculated incorrectly.
#define MXE_FILEWERR
An error occurred while writing to a file.
#define MXE_PARAMNOTSET
A parameter was not set.
#define MXE_FILECERR
An error occurred while closing a file.
#define MXE_NOTIMPL
A component or technique is not implemented.
#define MXE_FILEOERR
An error occurred while opening a file.
#define MXE_NOTFOUND
An item was not found.
The mxlib error reporting system.