mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Error Handling

How mxlib handles errors

Modules

 Error Handling Macros
 
 Exceptions
 
 Error Handling Files
 
 mxlib Error Codes
 

Functions

std::string mx::MXE_CodeToName (int ec)
 Return the name for an mxlib error code. More...
 
std::string mx::MXE_CodeToDescription (int ec)
 Return the description for an mxlib error code. More...
 
std::string mx::errno_CodeToName (int ec)
 Return the macro name and a message for a standard errno code. More...
 
std::string mx::error_report (const std::string &source, const int &code, const std::string &file, const int &line, const std::string &expl="")
 Construct a rich error report given an mxlib error code. More...
 
std::string mx::errno_report (const std::string &source, int ec, const std::string &file, const int &line, const std::string &expl="")
 Construct a rich error report given a standard errno error code. More...
 

Function Documentation

◆ errno_CodeToName()

std::string mx::errno_CodeToName ( int  ec)

Return the macro name and a message for a standard errno code.

Returns
the name of the macro corresponding to the code.
Parameters
[in]ecthe error code

Definition at line 132 of file mxError.cpp.

Referenced by mx::err::mxException::build_what(), and mx::errno_report().

◆ errno_report()

std::string mx::errno_report ( const std::string &  source,
int  ec,
const std::string &  file,
const int &  line,
const std::string &  expl = "" 
)

Construct a rich error report given a standard errno error code.

Returns
the formatted error report.
Parameters
[in]sourceintended to identify the component (i.e. the class name)
[in]ecan errno erro code
[in]filefile should be passed the __FILE__ macro
[in]lineline should be passed the __LINE__ macro
[in]expl[optional] if more information can be provided, use this to inform the user.

Definition at line 486 of file mxError.cpp.

References mx::errno_CodeToName().

◆ error_report()

std::string mx::error_report ( const std::string &  source,
const int &  code,
const std::string &  file,
const int &  line,
const std::string &  expl = "" 
)

Construct a rich error report given an mxlib error code.

Returns
the formatted error report.
Parameters
[in]sourceis intended to identify the mxlib component (i.e. the class name)
[in]codeis an MXE_* error code
[in]fileshould be passed the __FILE__ macro
[in]lineshould be passed the __LINE__ macro
[in]expl[optional] if more information can be provided, use this to inform the user.

Definition at line 458 of file mxError.cpp.

References mx::MXE_CodeToDescription(), and mx::MXE_CodeToName().

◆ MXE_CodeToDescription()

std::string mx::MXE_CodeToDescription ( int  ec)

Return the description for an mxlib error code.

Returns
the description for and error code.
Parameters
[in]ecthe error code

Definition at line 82 of file mxError.cpp.

Referenced by mx::error_report().

◆ MXE_CodeToName()

std::string mx::MXE_CodeToName ( int  ec)

Return the name for an mxlib error code.

Returns
the name of the macro corresponding to the error code.
Parameters
[in]ecthe error code

Definition at line 32 of file mxError.cpp.

Referenced by mx::error_report().