xapian-core
1.4.27
|
Decide if a Xapian::Error exception should be ignored. More...
#include <errorhandler.h>
Public Member Functions | |
ErrorHandler () | |
Default constructor. More... | |
virtual | ~ErrorHandler () |
We require a virtual destructor because we have virtual methods. More... | |
void | operator() (Xapian::Error &error) |
Handle a Xapian::Error object. More... | |
ErrorHandler * | release () |
Start reference counting this object. More... | |
const ErrorHandler * | release () const |
Start reference counting this object. More... | |
Public Member Functions inherited from Xapian::Internal::opt_intrusive_base | |
opt_intrusive_base (const opt_intrusive_base &) | |
opt_intrusive_base & | operator= (const opt_intrusive_base &) |
opt_intrusive_base () | |
Construct object which is initially not reference counted. More... | |
virtual | ~opt_intrusive_base () |
void | ref () const |
void | unref () const |
Private Member Functions | |
void | operator= (const ErrorHandler &) |
Don't allow assignment. More... | |
ErrorHandler (const Xapian::ErrorHandler &) | |
Don't allow copying. More... | |
virtual bool | handle_error (Xapian::Error &error)=0 |
Perform user-specified error handling. More... | |
Additional Inherited Members | |
Public Attributes inherited from Xapian::Internal::opt_intrusive_base | |
unsigned | _refs |
Reference count. More... | |
Protected Member Functions inherited from Xapian::Internal::opt_intrusive_base | |
void | release () const |
Start reference counting. More... | |
Decide if a Xapian::Error exception should be ignored.
You can create your own subclass of this class and pass in an instance of it when you construct a Xapian::Enquire object. Xapian::Error exceptions which happen during the match process are passed to this object and it can decide whether they should propagate or whether Enquire should attempt to continue.
The motivation is to allow searching over remote databases to handle a remote server which has died (both to allow results to be returned, and also so that such errors can be logged and dead servers temporarily removed from use).
Definition at line 50 of file errorhandler.h.
|
private |
Don't allow copying.
|
inline |
Default constructor.
Definition at line 81 of file errorhandler.h.
|
virtual |
We require a virtual destructor because we have virtual methods.
Definition at line 26 of file errorhandler.cc.
|
privatepure virtual |
Perform user-specified error handling.
This virtual method must be defined by the API user to specify how a Xapian::Error is to be handled.
If you want execution to continue (where possible), then return true. If you want the Error to be rethrown and propagate out of the library, then return false.
Note that it's not always possible to continue execution, so the error may be rethrown even if you return true. The ErrorHandler is still called in this situation as you may want to log that a particular remote backend server isn't responding, and perhaps remove it from those being searched temporarily.
error | The Xapian::Error object under consideration. |
Referenced by operator()().
void Xapian::ErrorHandler::operator() | ( | Xapian::Error & | error | ) |
Handle a Xapian::Error object.
This method is called when a Xapian::Error object is thrown and caught inside Enquire. If this is the first ErrorHandler that the Error has been passed to, then the handle_error() virtual method is called, which allows the API user to decide how to handle the error.
error | The Xapian::Error object under consideration. |
Definition at line 29 of file errorhandler.cc.
References Xapian::Error::already_handled, and handle_error().
|
private |
Don't allow assignment.
|
inline |
Start reference counting this object.
You can hand ownership of a dynamically allocated ErrorHandler object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.
Definition at line 105 of file errorhandler.h.
|
inline |
Start reference counting this object.
You can hand ownership of a dynamically allocated ErrorHandler object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.
Definition at line 117 of file errorhandler.h.