mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
The mxlib exception class.
Provides a rich error report via the standard what().
Definition at line 44 of file mxException.hpp.
#include <mxException.hpp>
Public Member Functions | |
mxException () noexcept | |
Default constructor. More... | |
mxException (const mxException &e) noexcept | |
Copy constructor. More... | |
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. More... | |
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. More... | |
mxException & | operator= (const mxException &e) noexcept |
Assignment operator. More... | |
virtual | ~mxException () throw () |
Destructor. More... | |
virtual void | build_what () |
Build the what string. More... | |
virtual const char * | what () const noexcept |
Return the details of the exception as a single string. More... | |
Protected Attributes | |
char | m_whatstr [4096] |
Contains the what() string. More... | |
std::string | m_source {""} |
The source of the exception, such as stdlib or cfitisio or the function name. More... | |
int | m_code {0} |
The mxlib error code. More... | |
std::string | m_codeName {""} |
The name of the error code. More... | |
int | m_errno {0} |
The errno error code (only used if non-zero) More... | |
std::string | m_file {""} |
The source file where the exception originated. More... | |
int | m_line {0} |
The line number of the file where the exception originated. More... | |
std::string | m_explanation {""} |
The long explanation of the error. More... | |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Construct and fill in each of the values, except errno.
[in] | esrc | the source of the exception, typically the class and function |
[in] | ec | the error code |
[in] | emnem | the name of the error code |
[in] | efile | the source file in which the exception occurred, normally __FILE__ |
[in] | line | the line number where the exception was thrown |
[in] | expl | the explanation for why the exception was thrown |
Definition at line 87 of file mxException.hpp.
References build_what().
|
inline |
Construct and fill in each of the values, including errno.
[in] | esrc | the source of the exception, typically the class and function |
[in] | ec | the error code |
[in] | emnem | the name of the error code |
[in] | en | the value of errno |
[in] | efile | the source file in which the exception occurred, normally __FILE__ |
[in] | line | the line number where the exception was thrown |
[in] | expl | the explanation for why the exception was thrown |
Definition at line 99 of file mxException.hpp.
References build_what().
|
inlinevirtual |
Destructor.
Definition at line 128 of file mxException.hpp.
|
inlinevirtual |
Build the what string.
Must be called after updating any values, since the what() method is const const.
Definition at line 135 of file mxException.hpp.
References mx::errno_CodeToName(), m_code, m_codeName, m_errno, m_explanation, m_file, m_line, m_source, and m_whatstr.
Referenced by mxException(), and operator=().
|
inlinenoexcept |
Assignment operator.
Definition at line 112 of file mxException.hpp.
References build_what(), m_code, m_codeName, m_errno, m_explanation, m_file, m_line, and m_source.
|
inlinevirtualnoexcept |
Return the details of the exception as a single string.
Definition at line 162 of file mxException.hpp.
References m_whatstr.
|
protected |
The mxlib error code.
Definition at line 55 of file mxException.hpp.
Referenced by build_what(), and operator=().
|
protected |
The name of the error code.
Definition at line 58 of file mxException.hpp.
Referenced by build_what(), and operator=().
|
protected |
The errno error code (only used if non-zero)
Definition at line 61 of file mxException.hpp.
Referenced by build_what(), and operator=().
|
protected |
The long explanation of the error.
Definition at line 70 of file mxException.hpp.
Referenced by build_what(), and operator=().
|
protected |
The source file where the exception originated.
Definition at line 64 of file mxException.hpp.
Referenced by build_what(), and operator=().
|
protected |
The line number of the file where the exception originated.
Definition at line 67 of file mxException.hpp.
Referenced by build_what(), and operator=().
|
protected |
The source of the exception, such as stdlib or cfitisio or the function name.
Definition at line 52 of file mxException.hpp.
Referenced by build_what(), and operator=().
|
protected |
Contains the what() string.
Definition at line 49 of file mxException.hpp.
Referenced by build_what(), and what().