xapian-core  1.4.27
errorhandler.cc
Go to the documentation of this file.
1 
4 /* Copyright (C) 2009 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <config.h>
22 
23 #include "xapian/errorhandler.h"
24 #include "xapian/error.h"
25 
27 
28 void
30 {
31  if (!error.already_handled) {
32  error.already_handled = true;
33  if (handle_error(error))
34  return;
35  }
36  throw error;
37 }
Hierarchy of classes which Xapian can throw as exceptions.
Decide if a Xapian::Error exception should be ignored.
bool already_handled
True if this error has already been passed to an ErrorHandler.
Definition: error.h:86
void operator()(Xapian::Error &error)
Handle a Xapian::Error object.
Definition: errorhandler.cc:29
virtual ~ErrorHandler()
We require a virtual destructor because we have virtual methods.
Definition: errorhandler.cc:26
All exceptions thrown by Xapian are subclasses of Xapian::Error.
Definition: error.h:43
virtual bool handle_error(Xapian::Error &error)=0
Perform user-specified error handling.