36 string result(1, (e.
get_type())[-1]);
43 if (err) result += err;
49 const string &new_context)
52 const char * p = serialised_error.c_str();
53 const char * end = p + serialised_error.size();
59 string context(p, len);
67 const char * error_string = (p == end) ? NULL : p;
69 if (!new_context.empty()) {
70 if (!context.empty()) {
71 msg +=
"; context was: ";
74 context = new_context;
length encoded as a string
const std::string & get_msg() const
Message giving details of the error, intended for human consumption.
string serialise_error(const Xapian::Error &e)
Serialise a Xapian::Error object to a string.
const char * get_type() const
The type of this error (e.g. "DocNotFoundError".)
std::string encode_length(T len)
Encode a length as a variable-length string.
Hierarchy of classes which Xapian can throw as exceptions.
void unserialise_error(const string &serialised_error, const string &prefix, const string &new_context)
Unserialise a Xapian::Error object and throw it.
InternalError indicates a runtime problem of some sort.
void decode_length_and_check(const char **p, const char *end, unsigned &out)
Decode a length encoded by encode_length.
const char * get_error_string() const
Returns any system error string associated with this exception.
All exceptions thrown by Xapian are subclasses of Xapian::Error.
const std::string & get_context() const
Optional context information.
functions to convert classes to strings and back