39 return MXE_INVALIDARG_NAME;
41 return MXE_INVALIDCONFIG_NAME;
43 return MXE_NOTIMPL_NAME;
45 return MXE_PARAMNOTSET_NAME;
47 return MXE_ENVNOTSET_NAME;
49 return MXE_NOTFOUND_NAME;
51 return MXE_SIZEERR_NAME;
53 return MXE_ALLOCERR_NAME;
55 return MXE_FREEERR_NAME;
57 return MXE_PARSEERR_NAME;
59 return MXE_FILEOERR_NAME;
61 return MXE_FILEWERR_NAME;
63 return MXE_FILERERR_NAME;
65 return MXE_FILECERR_NAME;
67 return MXE_FILENOTFOUND_NAME;
69 return MXE_PROCERR_NAME;
71 return MXE_TIMEOUT_NAME;
73 return MXE_LIBERR_NAME;
75 return MXE_GNUPLOTERR_NAME;
77 return MXE_LAPACKERR_NAME;
89 return MXE_INVALIDARG_MSG;
91 return MXE_INVALIDCONFIG_MSG;
93 return MXE_NOTIMPL_MSG;
95 return MXE_PARAMNOTSET_MSG;
97 return MXE_ENVNOTSET_MSG;
99 return MXE_NOTFOUND_MSG;
101 return MXE_SIZEERR_MSG;
103 return MXE_ALLOCERR_MSG;
105 return MXE_FREEERR_MSG;
107 return MXE_PARSEERR_MSG;
109 return MXE_FILEOERR_MSG;
111 return MXE_FILEWERR_MSG;
113 return MXE_FILERERR_MSG;
115 return MXE_FILECERR_MSG;
117 return MXE_FILENOTFOUND_MSG;
119 return MXE_PROCERR_MSG;
121 return MXE_TIMEOUT_MSG;
123 return MXE_LIBERR_MSG;
125 return MXE_GNUPLOTERR_MSG;
127 return MXE_LAPACKERR_MSG;
129 return "Unknown mxlib error code.";
151 return "EADDRNOTAVAIL";
155 return "EAFNOSUPPORT";
159 #if ( EWOULDBLOCK == EAGAIN )
160 return "EAGIAN / EWOULDBLOCK";
191 return "ECONNABORTED";
195 return "ECONNREFUSED";
203 return "EDESTADDRREQ";
223 return "EHOSTUNREACH";
235 return "EINPROGRESS";
275 return "ENAMETOOLONG";
287 return "ENETUNREACH";
331 return "ENOPROTOOPT";
361#ifdef ENOTRECOVERABLE
362 case ENOTRECOVERABLE:
363 return "ENOTRECOVERABLE";
370 #if ( ENOTSUP != EOPNOTSUPP )
407#ifdef EPROTONOSUPPORT
408 case EPROTONOSUPPORT:
409 return "EPROTONOSUPPORT";
444 #if ( EWOULDBLOCK != EAGAIN )
446 return "EWOULDBLOCK";
459 const std::string &source,
const int &code,
const std::string &file,
const int &line,
const std::string &expl )
462 std::string codeName, codeMessage;
467 std::ostringstream s;
470 s <<
"An error has occured in an mxlib component.\n";
471 s <<
" source: " << source <<
"\n";
472 s <<
" code: " << codeName <<
"(" << code <<
")\n";
473 s <<
" code msg: " << codeMessage <<
"\n";
474 s <<
" in file: " << file <<
"\n";
475 s <<
" at line: " << line <<
"\n";
477 s <<
" explanation: " << expl <<
"\n";
483errno_report(
const std::string &source,
int ec,
const std::string &file,
const int &line,
const std::string &expl )
485 std::string codeName, codeMessage;
488 codeMessage = strerror( ec );
490 std::ostringstream s;
493 s <<
"An error has occured in an mxlib component.\n";
494 s <<
" source: " << source <<
"\n";
495 s <<
" errno code: " << codeName <<
"(" << ec <<
")\n";
496 s <<
" code msg: " << codeMessage <<
"\n";
497 s <<
" in file: " << file <<
"\n";
498 s <<
" at line: " << line <<
"\n";
500 s <<
" explanation: " << expl <<
"\n";
510 [[maybe_unused]]
const std::string &expl,
511 [[maybe_unused]]
const std::source_location &loc )
518 const std::string &expl,
519 [[maybe_unused]]
const std::source_location &loc )
521 return std::format(
"{}: {}.",
errorName( code ), expl );
528 return std::format(
"{} ({}): {}. [{} {}]",
540 return std::format(
"An error has occurred in mxlib:\n"
551 loc.function_name() );
569 return std::format(
"{} ({}). [{} {}]",
errorMessage( code ),
errorName( code ), loc.file_name(), loc.line() );
575 return std::format(
"An error has occurred in mxlib:\n"
584 loc.function_name() );
589 [[maybe_unused]]
const std::string &expl,
590 [[maybe_unused]]
const std::source_location &loc )
606 [[maybe_unused]]
const std::string &expl,
607 [[maybe_unused]]
const std::source_location &loc )
627 return std::format(
"An error has occurred:\n"
638 loc.function_name() );
643 [[maybe_unused]]
const std::source_location &loc )
663 return std::format(
"An error has occurred:\n"
672 loc.function_name() );
677 [[maybe_unused]]
const std::string &expl,
678 [[maybe_unused]]
const std::source_location &loc )
error_t
The mxlib error codes.
static constexpr const char * errorName(const error_t &errc)
Convert an error_t code to its name.
static constexpr const char * errorMessage(const error_t &errc)
Get the descriptive message for an error_t code.
std::string MXE_CodeToName(int ec)
Return the name for an mxlib error code.
std::string errno_CodeToName(int ec)
Return the macro name and a message for a standard errno code.
std::string MXE_CodeToDescription(int ec)
Return the description for an mxlib error code.
std::string 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.
std::string error_message< verbose::v >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of error_message for verbose::v.
std::string error_message< verbose::vv >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of error_message for verbose::vv.
error_t error_report< verbose::o >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of error_report for verbose::o.
std::string error_message< verbose::o >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of error_message for verbose::o.
error_t 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.
std::string error_message< verbose::vvv >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of error_message for verbose::vvv.
std::string mxlib_error_message< verbose::v >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of mxlib_error_message for verbose::v.
std::string mxlib_error_message< verbose::o >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of mxlib_error_message for verbose::o.
std::string mxlib_error_message< verbose::vv >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of mxlib_error_message for verbose::vv.
std::string mxlib_error_message< verbose::vvv >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of mxlib_error_message for verbose::vvv.
error_t mxlib_error_report< verbose::o >(const error_t &code, const std::string &expl, const std::source_location &loc)
Specialization of mxlib_error_report for verbose::o.
#define MXE_PROCERR
An error occrred while starting a process.
#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_FILENOTFOUND
The file was not found.
#define MXE_LAPACKERR
An error was returned by Lapack.
#define MXE_LIBERR
An error was returned by a library.
#define MXE_ENVNOTSET
An environment variable is not set.
#define MXE_GNUPLOTERR
An error was returned by gnuplot.
#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_PARSEERR
A parsing error occurred.
#define MXE_FILEOERR
An error occurred while opening a file.
#define MXE_TIMEOUT
A timeout occurred.
#define MXE_FREEERR
An error occurred during memory de-allocation.
#define MXE_NOTFOUND
An item was not found.
The mxlib error reporting system.