42 const char * type_,
const char * error_string_)
43 : msg(msg_), context(context_), error_string(), type(type_),
44 my_errno(0), already_handled(
false)
55 if (my_errno < 0 || my_errno >= WSABASEERR) {
59 len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|
60 FORMAT_MESSAGE_ALLOCATE_BUFFER,
61 0, e, 0, (CHAR*)&error, 0, 0);
64 if (len >= 2 && memcmp(error + len - 2,
"\r\n", 2) == 0)
99 desc +=
" (context: ";
Convert errno value to std::string, thread-safe if possible.
std::string error_string
The error string derived from my_errno.
Convert types to std::string.
include <netdb.h>, with portability workarounds.
const char * get_type() const
The type of this error (e.g. "DocNotFoundError".)
Hierarchy of classes which Xapian can throw as exceptions.
void description_append(std::string &desc, const std::string &s)
void errno_to_string(int e, string &s)
string str(int value)
Convert int to std::string.
std::string msg
Message giving details of the error, intended for human consumption.
std::string get_description() const
Return a string describing this object.
Error(const std::string &msg_, const std::string &context_, const char *type_, const char *error_string_)
Constructor for use by constructors of derived classes.
include <windows.h> without all the bloat and damage.
Append a string to an object description, escaping invalid UTF-8.
std::string context
Optional context information.
const char * get_error_string() const
Returns any system error string associated with this exception.
int my_errno
Optional value of 'errno' associated with this error.