mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
error.hpp File Reference

The mxlib error reporting system. More...

The mxlib error reporting system.

Definition in file error.hpp.

#include <source_location>
#include <iostream>
#include <string>
#include "error_t.hpp"

Go to the source code of this file.

Classes

struct  mx::verbose::o
 Verbosity level 0, no reports are generated or printed to stderr. More...
 
struct  mx::verbose::v
 Verbosity level 1. Minimal reports with no source location information. More...
 
struct  mx::verbose::vv
 Verbosity level 2. Additional information is provided, including source file and line. More...
 
struct  mx::verbose::vvv
 Verbosity level 3. A full report is provided. More...
 

Namespaces

namespace  mx
 The mxlib c++ namespace.
 
namespace  mx::verbose
 Namespace for the error reporting verbosity levels.
 
namespace  mx::internal
 Namespace for the internal error reporting functions.
 

Macros

#define mxlib_error_check(fxn)
 Perform an error check, if an error occurs report it and return the error. Does not return on no error.
 
#define mxlib_error_return(fxn)
 Perform an error check, if an error occurs report it, and return the error code even if no error.
 
#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.
 

Typedefs

typedef MXLIB_DEFAULT_VERBOSITY mx::verbose::d
 The default verbosity.
 

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::internal::mxlib_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::internal::mxlib_error_message< mx::verbose::o > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::o.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::v > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::v.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vv > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::vv.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vvv > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::vvv.
 
template<class verboseT = verbose::d>
std::string mx::internal::mxlib_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::internal::mxlib_error_message< mx::verbose::o > (const error_t &code, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::o.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::v > (const error_t &code, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::v.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vv > (const error_t &code, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::vv.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vvv > (const error_t &code, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::vvv.
 
template<class verboseT = verbose::d>
error_t mx::internal::mxlib_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::internal::mxlib_error_report< mx::verbose::o > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of mxlib_error_report for verbose::o.
 
template<class verboseT = verbose::d>
error_t mx::internal::mxlib_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::internal::mxlib_error_report< mx::verbose::o > (const error_t &code, const std::source_location &loc)
 Specialization of mxlib_error_report for verbose::o.
 
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.