1 #ifndef WREPORT_ERROR_H 2 #define WREPORT_ERROR_H 39 WR_ERR_CONSISTENCY = 8,
47 WR_ERR_UNIMPLEMENTED = 12,
56 #define WREPORT_THROWF_ATTRS(a, b) __attribute__ ((noreturn, format(printf, a, b))) 59 struct error :
public std::exception
69 virtual const char*
what()
const noexcept = 0;
93 const char*
what() const noexcept
override {
return msg; }
97 template<ErrorCode ERROR_CODE>
108 const char*
what() const noexcept
override {
return msg.c_str(); }
116 using StringBase::StringBase;
128 using StringBase::StringBase;
141 using StringBase::StringBase;
150 using StringBase::StringBase;
185 using StringBase::StringBase;
194 using StringBase::StringBase;
204 error_parse(
const char* file,
int line,
const std::string& msg);
207 static void throwf(
const char* file,
int line,
const char* fmt, ...)
WREPORT_THROWF_ATTRS(3, 4);
231 using StringBase::StringBase;
240 using StringBase::StringBase;
Base class for DB-All.e exceptions.
Definition: error.h:59
const char * what() const noexceptoverride
Error message.
Definition: error.h:108
virtual ErrorCode code() const noexcept=0
Exception-specific error code.
Reports that memory allocation has failed.
Definition: error.h:76
Report an error while handling regular expressions.
Definition: error.h:211
Report an error when parsing informations.
Definition: error.h:192
ErrorCode code() const noexceptoverride
Exception-specific error code.
Definition: error.h:106
Report an error when a consistency check failed.
Definition: error.h:183
Reports that a feature is still not implemented.
Definition: error.h:229
No error.
Definition: error.h:23
For functions working with handles, reports a problem with handling handles, such as impossibility to...
Definition: error.h:139
For functions handling data with multiple types, reports a mismatch between the type requested and th...
Definition: error.h:126
const char * what() const noexceptoverride
Throw the exception, building the message printf-style.
Definition: error.h:93
static const char * strerror(ErrorCode code)
String description for an error code.
ErrorCode code() const noexceptoverride
Exception-specific error code.
Definition: error.h:90
Report that a parameter is outside the acceptable domain.
Definition: error.h:238
Reports that a search-like function could not find what was requested.
Definition: error.h:114
const char * msg
error message returned by what()
Definition: error.h:79
error_alloc(const char *msg)
Definition: error.h:87
std::string msg
error message returned by what()
Definition: error.h:101
StringBase(const std::string &msg) noexcept
Definition: error.h:104
String functions.
Definition: benchmark.h:13
Report a system error message.
Definition: error.h:160
virtual const char * what() const noexcept=0
Error message.
#define WREPORT_THROWF_ATTRS(a, b)
Tell the compiler that a function always throws and expects printf-style arguments.
Definition: error.h:56
ErrorCode
C-style error codes used by exceptions.
Definition: error.h:21