Fix build with xapian-core < 1.4.10
[xapian.git] / search-xapian / exception_data.pm
blob7a11d10e5487f54d2f7c2cea1fc5b239475a0a5e
1 # exception_data.pm: details of the exception hierarchy used by Xapian.
3 # Copyright (C) 2003,2004,2006,2007,2008,2009,2020 Olly Betts
4 # Copyright (C) 2007 Richard Boulton
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.
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.
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
20 package exception_data;
21 use Exporter;
22 @ISA = qw(Exporter);
23 @EXPORT = qw($copyright $generated_warning @baseclasses @classes %subclasses);
25 $copyright = <<'EOF';
26 /* Copyright (C) 2003,2004,2006,2007,2009 Olly Betts
28 * This program is free software; you can redistribute it and/or
29 * modify it under the terms of the GNU General Public License as
30 * published by the Free Software Foundation; either version 2 of the
31 * License, or (at your option) any later version.
33 * This program is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 * GNU General Public License for more details.
38 * You should have received a copy of the GNU General Public License
39 * along with this program; if not, write to the Free Software
40 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
42 EOF
44 $generated_warning =
45 "/* Warning: This file is generated by $0 - do not modify directly! */\n";
47 @baseclasses = ();
48 @classes = ();
49 %subclasses = ();
51 sub errorbaseclass {
52 push @baseclasses, join("\t", @_);
53 push @{$subclasses{$_[1]}}, $_[0];
56 sub errorclass {
57 push @classes, join("\t", @_);
58 push @{$subclasses{$_[1]}}, $_[0];
61 errorbaseclass('LogicError', 'Error', <<'DOC');
62 /** The base class for exceptions indicating errors in the program logic.
64 * A subclass of LogicError will be thrown if Xapian detects a violation
65 * of a class invariant or a logical precondition or postcondition, etc.
67 DOC
69 errorclass('AssertionError', 'LogicError', <<'DOC');
70 /** AssertionError is thrown if a logical assertion inside Xapian fails.
72 * In a debug build of Xapian, a failed assertion in the core library code
73 * will cause AssertionError to be thrown.
75 * This represents a bug in Xapian (either an invariant, precondition, etc
76 * has been violated, or the assertion is incorrect!)
78 DOC
80 errorclass('InvalidArgumentError', 'LogicError', <<'DOC');
81 /** InvalidArgumentError indicates an invalid parameter value was passed to the API.
83 DOC
85 errorclass('InvalidOperationError', 'LogicError', <<'DOC');
86 /** InvalidOperationError indicates the API was used in an invalid way.
88 DOC
90 errorclass('UnimplementedError', 'LogicError', <<'DOC');
91 /** UnimplementedError indicates an attempt to use an unimplemented feature. */
92 DOC
94 # RuntimeError and subclasses:
96 errorbaseclass('RuntimeError', 'Error', <<'DOC');
97 /** The base class for exceptions indicating errors only detectable at runtime.
99 * A subclass of RuntimeError will be thrown if Xapian detects an error
100 * which is exception derived from RuntimeError is thrown when an
101 * error is caused by problems with the data or environment rather
102 * than a programming mistake.
106 errorclass('DatabaseError', 'RuntimeError', <<'DOC');
107 /** DatabaseError indicates some sort of database related error. */
110 errorclass('DatabaseCorruptError', 'DatabaseError', <<'DOC');
111 /** DatabaseCorruptError indicates database corruption was detected. */
114 errorclass('DatabaseCreateError', 'DatabaseError', <<'DOC');
115 /** DatabaseCreateError indicates a failure to create a database. */
118 errorclass('DatabaseLockError', 'DatabaseError', <<'DOC');
119 /** DatabaseLockError indicates failure to lock a database. */
122 errorclass('DatabaseModifiedError', 'DatabaseError', <<'DOC');
123 /** DatabaseModifiedError indicates a database was modified.
125 * To recover after catching this error, you need to call
126 * Xapian::Database::reopen() on the Database and repeat the operation
127 * which failed.
131 errorclass('DatabaseOpeningError', 'DatabaseError', <<'DOC');
132 /** DatabaseOpeningError indicates failure to open a database. */
135 errorclass('DatabaseVersionError', 'DatabaseOpeningError', <<'DOC');
136 /** DatabaseVersionError indicates that a database is in an unsupported format.
138 * From time to time, new versions of Xapian will require the database format
139 * to be changed, to allow new information to be stored or new optimisations
140 * to be performed. Backwards compatibility will sometimes be maintained, so
141 * that new versions of Xapian can open old databases, but in some cases
142 * Xapian will be unable to open a database because it is in too old (or new)
143 * a format. This can be resolved either be upgrading or downgrading the
144 * version of Xapian in use, or by rebuilding the database from scratch with
145 * the current version of Xapian.
149 errorclass('DocNotFoundError', 'RuntimeError', <<'DOC');
150 /** Indicates an attempt to access a document not present in the database. */
153 errorclass('FeatureUnavailableError', 'RuntimeError', <<'DOC');
154 /** Indicates an attempt to use a feature which is unavailable.
156 * Typically a feature is unavailable because it wasn't compiled in, or
157 * because it requires other software or facilities which aren't available.
161 errorclass('InternalError', 'RuntimeError', <<'DOC');
162 /** InternalError indicates a runtime problem of some sort. */
165 errorclass('NetworkError', 'RuntimeError', <<'DOC');
166 /** Indicates a problem communicating with a remote database. */
169 errorclass('NetworkTimeoutError', 'NetworkError', <<'DOC');
170 /** Indicates a timeout expired while communicating with a remote database. */
173 errorclass('QueryParserError', 'RuntimeError', <<'DOC');
174 /** Indicates a query string can't be parsed. */
177 errorclass('SerialisationError', 'RuntimeError', <<'DOC');
178 /** Indicates an error in the std::string serialisation of an object. */
181 errorclass('RangeError', 'RuntimeError', <<'DOC');
182 /** RangeError indicates an attempt to access outside the bounds of a container.
186 $::version >= 1003003 and errorclass('WildcardError', 'RuntimeError', <<'DOC');
187 /** WildcardError indicates an error expanding a wildcarded query.
191 $::version >= 1004010 and errorclass('DatabaseNotFoundError', 'DatabaseOpeningError', <<'DOC');
192 /** Indicates an attempt to access a database not present.
196 $::version >= 1004010 and errorclass('DatabaseClosedError', 'DatabaseError', <<'DOC');
197 /** Indicates an attempt to access a closed database.