|
mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
How mxlib handles errors
Modules | |
| Error Codes | |
| Old Error Handling | |
| Error Handling Files | |
| Error Report Verbosity | |
| Internal Error Reporting | |
Macros | |
| #define | mx_error_check(fxn) |
| Perform an error check on the output of a function. | |
| #define | mx_error_check_code(errc) |
| Perform an error check on an error_t code. | |
| #define | mx_error_check_rv(fxn, rv) |
| Perform an error check on the output of a function. | |
| #define | mx_error_check_code_rv(errc, rv) |
| Perform an error check on an error_t code. | |
| #define | mx_error_return(fxn) |
| Perform an error check on a function and return the result. | |
| #define | mx_error_return_code(errc) |
| Perform an error check on an error_t code and return the result. | |
Functions | |
| bool | mx::operator! (const error_t &errc) |
| Check if an error_t code is an error. | |
| bool | mx::operator== (const error_t &errc, bool tf) |
| Check if an error_t code is an error. | |
| bool | mx::operator!= (const error_t &errc, bool tf) |
| Check if an error_t code is not an error. | |
| bool | mx::isError (const error_t &errc) |
| Check if an error_t code is an error. | |
| template<class verboseT = verbose::d> | |
| std::string | mx::error_message (const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current()) |
Format a report given an mxlib error_t code and explanation. | |
| template<> | |
| std::string | mx::error_message< mx::verbose::o > (const error_t &code, const std::string &expl, const std::source_location &loc) |
| Specialization of error_message for verbose::o. | |
| template<> | |
| std::string | mx::error_message< mx::verbose::v > (const error_t &code, const std::string &expl, const std::source_location &loc) |
| Specialization of error_message for verbose::v. | |
| template<> | |
| std::string | mx::error_message< mx::verbose::vv > (const error_t &code, const std::string &expl, const std::source_location &loc) |
| Specialization of error_message for verbose::vv. | |
| template<> | |
| std::string | mx::error_message< mx::verbose::vvv > (const error_t &code, const std::string &expl, const std::source_location &loc) |
| Specialization of error_message for verbose::vvv. | |
| template<class verboseT = verbose::vvv> | |
| std::string | mx::error_message (const error_t &code, const std::source_location &loc=std::source_location::current()) |
Format a report given an mxlib error_t code. | |
| template<> | |
| std::string | mx::error_message< mx::verbose::o > (const error_t &code, const std::source_location &loc) |
| Specialization of error_message for verbose::o. | |
| template<> | |
| std::string | mx::error_message< mx::verbose::v > (const error_t &code, const std::source_location &loc) |
| Specialization of error_message for verbose::v. | |
| template<> | |
| std::string | mx::error_message< mx::verbose::vv > (const error_t &code, const std::source_location &loc) |
| Specialization of error_message for verbose::vv. | |
| template<> | |
| std::string | mx::error_message< mx::verbose::vvv > (const error_t &code, const std::source_location &loc) |
| Specialization of error_message for verbose::vvv. | |
| template<class verboseT = verbose::vvv> | |
| error_t | mx::error_report (const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current()) |
Print a report to stderr given an mxlib error_t code and explanation and return the code. | |
| template<> | |
| error_t | mx::error_report< mx::verbose::o > (const error_t &code, const std::string &expl, const std::source_location &loc) |
| Specialization of error_report for verbose::o. | |
| template<class verboseT = verbose::vvv> | |
| error_t | mx::error_report (const error_t &code, const std::source_location &loc=std::source_location::current()) |
Print a report to stderr given an mxlib error_t code and return the code. | |
| template<> | |
| error_t | mx::error_report< mx::verbose::o > (const error_t &code, const std::source_location &loc) |
| Specialization of error_report for verbose::o. | |
| #define mx_error_check | ( | fxn | ) |
Perform an error check on the output of a function.
If an error occurs report it and return the error. Do not return on no error.
Scope protected so the error_t value does not interfere with other values.
| fxn | is the function to call and check the return value of |
| #define mx_error_check_code | ( | errc | ) |
Perform an error check on an error_t code.
If an error is indicated report it and return the error. Do not return on no error.
| errc | is the code to check for an error value |
| #define mx_error_check_code_rv | ( | errc, | |
| rv | |||
| ) |
Perform an error check on an error_t code.
If an error occurs report it and return an arbitrary type. Does not return on no error. This is intended to be used in int main(), or any other case where the return value is something other than mx::error_t.
| errc | is the code to check for an error value |
| #define mx_error_check_rv | ( | fxn, | |
| rv | |||
| ) |
Perform an error check on the output of a function.
If an error occurs report it and return an arbitrary type. Does not return on no error. This is intended to be used in int main(), or any other case where the return value is something other than mx::error_t.
Scope protected so the mx::error_t value does not interfere with other values.
| fxn | is the function to call and check the return value of (can also just be a code). |
| #define mx_error_return | ( | fxn | ) |
Perform an error check on a function and return the result.
If an error occurs it is reported. If no error occurs error_t::noerror is returned.
Scope protected so the error_t value does not interfere with other values.
| fxn | is the function to call and check the return value of |
| #define mx_error_return_code | ( | errc | ) |
Perform an error check on an error_t code and return the result.
If an error occurs it is reported and returned. If no error occurs error_t::noerror is returned.
| errc | is the function to call and check the return value of |
| std::string mx::error_message | ( | const error_t & | code, |
| const std::source_location & | loc = std::source_location::current() |
||
| ) |
Format a report given an mxlib error_t code.
What is included depends on the verbosity level set by the template parameter
| verboseT | sets the verbosity level based on its level member. |
| [in] | code | is an mx::error_t error code |
| [in] | loc | [opt] source location |
| std::string mx::error_message | ( | const error_t & | code, |
| const std::string & | expl, | ||
| const std::source_location & | loc = std::source_location::current() |
||
| ) |
Format a report given an mxlib error_t code and explanation.
What is included depends on the verbosity level set by the template parameter
| verboseT | sets the verbosity level based on its level member. |
| [in] | code | is an mx::error_t error code |
| [in] | expl | [opt] if more information can be provided, use this to inform the user. |
| [in] | loc | [opt] source location |
Referenced by unitTest::errorTest::errorTest::TEST_CASE().
| std::string mx::error_message< mx::verbose::o > | ( | const error_t & | code, |
| const std::source_location & | loc | ||
| ) |
Specialization of error_message for verbose::o.
| std::string mx::error_message< mx::verbose::o > | ( | const error_t & | code, |
| const std::string & | expl, | ||
| const std::source_location & | loc | ||
| ) |
Specialization of error_message for verbose::o.
Referenced by unitTest::errorTest::errorTest::TEST_CASE().
| std::string mx::error_message< mx::verbose::v > | ( | const error_t & | code, |
| const std::source_location & | loc | ||
| ) |
Specialization of error_message for verbose::v.
| std::string mx::error_message< mx::verbose::v > | ( | const error_t & | code, |
| const std::string & | expl, | ||
| const std::source_location & | loc | ||
| ) |
Specialization of error_message for verbose::v.
Referenced by unitTest::errorTest::errorTest::TEST_CASE().
| std::string mx::error_message< mx::verbose::vv > | ( | const error_t & | code, |
| const std::source_location & | loc | ||
| ) |
Specialization of error_message for verbose::vv.
| std::string mx::error_message< mx::verbose::vv > | ( | const error_t & | code, |
| const std::string & | expl, | ||
| const std::source_location & | loc | ||
| ) |
Specialization of error_message for verbose::vv.
Referenced by unitTest::errorTest::errorTest::TEST_CASE().
| std::string mx::error_message< mx::verbose::vvv > | ( | const error_t & | code, |
| const std::source_location & | loc | ||
| ) |
Specialization of error_message for verbose::vvv.
| std::string mx::error_message< mx::verbose::vvv > | ( | const error_t & | code, |
| const std::string & | expl, | ||
| const std::source_location & | loc | ||
| ) |
Specialization of error_message for verbose::vvv.
Referenced by unitTest::errorTest::errorTest::TEST_CASE().
| error_t mx::error_report | ( | const error_t & | code, |
| const std::source_location & | loc = std::source_location::current() |
||
| ) |
Print a report to stderr given an mxlib error_t code and return the code.
What is printed depends on the verbosity level set by the template parameter
| verboseT | sets the verbosity level based on its level member. |
code | [in] | code | is an mx::error_t error code |
| [in] | loc | [opt] source location |
Definition at line 576 of file error.hpp.
References mx::noerror.
| error_t mx::error_report | ( | const error_t & | code, |
| const std::string & | expl, | ||
| const std::source_location & | loc = std::source_location::current() |
||
| ) |
Print a report to stderr given an mxlib error_t code and explanation and return the code.
What is printed depends on the verbosity level set by the template parameter
| verboseT | sets the verbosity level based on its level member. |
code | [in] | code | is an mx::error_t error code |
| [in] | expl | [opt] if more information can be provided, use this to inform the user. |
| [in] | loc | [opt] source location |
Definition at line 540 of file error.hpp.
References mx::noerror.
Referenced by unitTest::errorTest::errorTest::TEST_CASE().
| error_t mx::error_report< mx::verbose::o > | ( | const error_t & | code, |
| const std::source_location & | loc | ||
| ) |
Specialization of error_report for verbose::o.
| error_t mx::error_report< mx::verbose::o > | ( | const error_t & | code, |
| const std::string & | expl, | ||
| const std::source_location & | loc | ||
| ) |
Specialization of error_report for verbose::o.
Referenced by unitTest::errorTest::errorTest::TEST_CASE().
|
inline |
Check if an error_t code is an error.
Treats errors as true/false, where false means equal to error_t::noerror and all other values are true.
| [in] | errc | the error_t code to check |
Definition at line 120 of file error.hpp.
References mx::noerror.
Referenced by unitTest::errorTest::errorTest::TEST_CASE().
|
inline |
Check if an error_t code is an error.
Treats errors as true/false, where false means equal to error_t::noerror and all other values are true. So not returns true if errc is equal to error_t::noerror. So one can use !! to check if an code is an error. Example:
| [in] | errc | the error_t code to check |
Definition at line 58 of file error.hpp.
References mx::noerror.
Referenced by unitTest::errorTest::errorTest::TEST_CASE().
|
inline |
Check if an error_t code is not an error.
Treats errors as true/false, where false means equal to error_t::noerror and all other values are true. Example:
| [in] | errc | the error_t code to check |
| [in] | tf | the value to compare to |
Definition at line 108 of file error.hpp.
References mx::noerror.
Referenced by mx::math::operator!=(), and unitTest::errorTest::errorTest::TEST_CASE().
|
inline |
Check if an error_t code is an error.
Treats errors as true/false, where false means equal to error_t::noerror and all other values are true. Example:
| [in] | errc | the error_t code to check |
| [in] | tf | the value to compare to |
Definition at line 82 of file error.hpp.
References mx::noerror.
Referenced by mx::math::operator==(), and unitTest::errorTest::errorTest::TEST_CASE().