version
0.0.1
Defines the C++ API for MsPASS
|
Base class for error object thrown by MsPASS library routines. More...
#include <MsPASSError.h>
Public Member Functions | |
MsPASSError () | |
MsPASSError (const std::string mess, const char *howbad) | |
Construct from a std::string with badness defined by keywords in a string. More... | |
MsPASSError (const std::string mess, const ErrorSeverity s=ErrorSeverity::Invalid) | |
MsPASSError (const char *mess, const ErrorSeverity s) | |
void | log_error () |
void | log_error (std::ostream &ofs) |
const char * | what () const noexcept |
ErrorSeverity | severity () const |
Protected Attributes | |
std::string | message |
ErrorSeverity | badness |
Base class for error object thrown by MsPASS library routines.
This is the generic error object thrown by the MsPASS library. it is similar in concept to basic error objects described in various books by Stroustrup. The base object contains only a simple generic message and a virtual log_error method common to all MsPASS error objects that are it's descendents.
|
inline |
Default constructor built inline.
|
inline |
Construct from a std::string with badness defined by keywords in a string.
Sometimes it is easier and more readable to use a string literal to define the error class. This uses that approach.
mess | is the error message posted. |
howbad | is a string to translate to one of the allowed enum values. The allowed values are the same as the enum defined in this file: FATAL,Invalid,Suspect,Complaint,Debug,Informational. |
|
inline |
Construct from a string with enum defining severity.
This should be the normal form of this error object to throw. Default of the enum allows simpler usage for most errors.
mess | - is the error message to be posted. |
s | is the severity enum (default Invalid). |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
This overrides the method in std::exception to load our string. This allows handlers to use the what method and get the error string from seisp. Idea copied from: http://www.cplusplus.com/doc/tutorial/exceptions/
pybind11 limitations make it problematic for python error handlers to get the output of the severity method or even get to the badness attribute. See the cc code for the implementation detail.
References message.
|
protected |
Defines the severity of this error - see enum class above
|
protected |
Holds error message that can be printed with log_error method.