36 string result(1, (e.
get_type())[-1]);
41 if (err) result += err;
47 const string &new_context)
50 const char *
p = serialised_error.c_str();
51 const char * end =
p + serialised_error.size();
62 const char * error_string = (
p == end) ? NULL :
p;
64 if (!new_context.empty()) {
65 if (!context.empty()) {
66 msg +=
"; context was: ";
69 context = new_context;
All exceptions thrown by Xapian are subclasses of Xapian::Error.
const char * get_error_string() const
Returns any system error string associated with this exception.
const std::string & get_msg() const noexcept
Message giving details of the error, intended for human consumption.
const char * get_type() const noexcept
The type of this error (e.g. "DocNotFoundError".)
const std::string & get_context() const noexcept
Optional context information.
InternalError indicates a runtime problem of some sort.
Hierarchy of classes which Xapian can throw as exceptions.
void unpack_throw_serialisation_error(const char *p)
Throw appropriate SerialisationError.
Pack types into strings and unpack them again.
bool unpack_string(const char **p, const char *end, std::string &result)
Decode a std::string from a string.
bool unpack_string_append(const char **p, const char *end, std::string &result)
Decode a std::string from a string and append.
void pack_string(std::string &s, std::string_view value)
Append an encoded std::string to a string.
void unserialise_error(const string &serialised_error, const string &prefix, const string &new_context)
Unserialise a Xapian::Error object and throw it.
string serialise_error(const Xapian::Error &e)
Serialise a Xapian::Error object to a string.
functions to convert classes to strings and back