# Xapian::Error Class Reference

All exceptions thrown by Xapian are subclasses of Xapian::Error. More...

Inheritance diagram for Xapian::Error:

[legend]
List of all members.

## Public Member Functions

const char * | get_type () const
| The type of this error (e.g. "DocNotFoundError".).
const std::string & | get_msg () const
| Message giving details of the error, intended for human consumption.
const std::string & | get_context () const
| Optional context information.
const char * | get_error_string () const
| Returns any system error string associated with this exception.
int | get_errno () const
| Optional value of 'errno' associated with this error.
std::string | get_description () const
| Return a string describing this object.

## Detailed Description

All exceptions thrown by Xapian are subclasses of Xapian::Error.

This class can not be instantiated directly - instead a subclass should be used.

## Member Function Documentation

const char* Xapian::Error::get_type | ( |  | ) | const`[inline]`

The type of this error (e.g. "DocNotFoundError".).

const std::string& Xapian::Error::get_msg | ( |  | ) | const`[inline]`

Message giving details of the error, intended for human consumption.

const std::string& Xapian::Error::get_context | ( |  | ) | const`[inline]`

Optional context information.

This context is intended for use by Xapian::ErrorHandler (for example so it can know which remote server is unreliable and report the problem and remove that server from those being searched). But it's typically a plain-text string, and so also fit for human consumption.

const char* Xapian::Error::get_error_string | ( |  | ) | const

Returns any system error string associated with this exception.

The system error string may come from errno, h_errno (on UNIX), or GetLastError() (on MS Windows). If there is no associated system error string, NULL is returned.

int Xapian::Error::get_errno | ( |  | ) | const`[inline]`

Optional value of 'errno' associated with this error.

If no 'errno' value is associated, returns 0. If the returned value is negative, it's a platform-specific error code (on UNIX, -h_errno; on MS Windows, -GetLastError()).

Deprecated:
  This method is deprecated, because errno values aren't portable between platforms, so we can't serialise them when passing exceptions from a remote server to a client. Use the get_error_string() method instead.

std::string Xapian::Error::get_description | ( |  | ) | const

Return a string describing this object.

The documentation for this class was generated from the following file:

- xapian/error.h