1 /** @file
2  *  @brief Hierarchy of classes which Xapian can throw as exceptions.
3  */
4 /* Warning: This file is generated by ./generate-exceptions - do not modify directly! */
5 /* Copyright (C) 2003,2004,2006,2007,2008,2009,2011,2015,2019 Olly Betts
6  * Copyright (C) 2007 Richard Boulton
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
21  */
22 
23 #ifndef XAPIAN_INCLUDED_ERROR_H
24 #define XAPIAN_INCLUDED_ERROR_H
25 
26 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD
27 # error Never use <xapian/error.h> directly; include <xapian.h> instead.
28 #endif
29 
30 #include <string>
31 #include <xapian/attributes.h>
32 #include <xapian/visibility.h>
33 
34 namespace Xapian {
35 
36 class ErrorHandler;
37 
38 /** All exceptions thrown by Xapian are subclasses of Xapian::Error.
39  *
40  *  This class can not be instantiated directly - instead a subclass should
41  *  be used.
42  */
43 class XAPIAN_VISIBILITY_DEFAULT Error {
44     // ErrorHandler needs to be able to access Error::already_handled.
45     friend class ErrorHandler;
46 
47     /// Message giving details of the error, intended for human consumption.
48     std::string msg;
49 
50     /** Optional context information.
51      *
52      *  This context is intended for use by Xapian::ErrorHandler (for example
53      *  so it can know which remote server is unreliable and report the problem
54      *  and remove that server from those being searched).  But it's typically
55      *  a plain-text string, and so also fit for human consumption.
56      */
57     std::string context;
58 
59     /** The error string derived from my_errno.
60      *
61      *  This string is generated from my_errno lazily.
62      */
63     mutable std::string error_string;
64 
65     /// The type of this error (e.g. DocNotFoundError.)
66     const char * type;
67 
68     /** Optional value of 'errno' associated with this error.
69      *
70      *  If no value is associated, this member variable will be 0.
71      *
72      *  On UNIX, if this value is < 0, it's an error code returned from
73      *  getaddrinfo() (negated if such error codes are positive).
74      *
75      *  On Windows, if this value is < 0, it's a negated Windows error code
76      *  (as given by GetLastError()), while if it is >= WSABASEERR then it is a
77      *  WinSock error code (as given by WSAGetLastError()).  Prior to Xapian
78      *  1.2.20 and 1.3.3, WSAGetLastError() codes were also negated.
79      *
80      *  NB We don't just call this member "errno" to avoid problems on
81      *  platforms where errno is a preprocessor macro.
82      */
83     int my_errno;
84 
85     /// True if this error has already been passed to an ErrorHandler.
86     bool already_handled;
87 
88     /// Don't allow assignment of the base class.
89     void operator=(const Error &o);
90 
91   protected:
92     /** @private @internal
93      *  @brief Constructor for use by constructors of derived classes.
94      */
95     Error(const std::string &msg_, const std::string &context_,
96 	  const char * type_, const char * error_string_);
97 
98     /** @private @internal
99      *  @brief Constructor for use by constructors of derived classes.
100      */
Error(const std::string & msg_,const std::string & context_,const char * type_,int errno_)101     Error(const std::string &msg_, const std::string &context_,
102 	  const char * type_, int errno_)
103 	: msg(msg_), context(context_), error_string(), type(type_),
104 	  my_errno(errno_), already_handled(false) { }
105 
106   public:
107 #if __cplusplus >= 201103L
108     /** Default copy constructor.
109      *
110      *  We explicitly specify this to avoid warnings from GCC 9 (from
111      *  -Wdeprecated-copy which is enabled by -Wextra).
112      */
113     Error(const Error&) = default;
114 #endif
115 
116     /// The type of this error (e.g. "DocNotFoundError".)
XAPIAN_NOTHROW(get_type ()const)117     const char * XAPIAN_NOTHROW(get_type() const) {
118 	return type + 1;
119     }
120 
121     /// Message giving details of the error, intended for human consumption.
XAPIAN_NOTHROW(get_msg ()const)122     const std::string & XAPIAN_NOTHROW(get_msg() const) {
123 	return msg;
124     }
125 
126     /** Optional context information.
127      *
128      *  This context is intended for use by Xapian::ErrorHandler (for example
129      *  so it can know which remote server is unreliable and report the problem
130      *  and remove that server from those being searched).  But it's typically
131      *  a plain-text string, and so also fit for human consumption.
132      */
XAPIAN_NOTHROW(get_context ()const)133     const std::string & XAPIAN_NOTHROW(get_context() const) {
134 	return context;
135     }
136 
137     /** Returns any system error string associated with this exception.
138      *
139      *  The system error string may come from errno, h_errno (on UNIX), or
140      *  GetLastError() (on MS Windows).  If there is no associated system
141      *  error string, NULL is returned.
142      */
143     const char * get_error_string() const;
144 
145     /// Return a string describing this object.
146     std::string get_description() const;
147 };
148 
149 /** The base class for exceptions indicating errors in the program logic.
150  *
151  *  A subclass of LogicError will be thrown if Xapian detects a violation
152  *  of a class invariant or a logical precondition or postcondition, etc.
153  */
154 class XAPIAN_VISIBILITY_DEFAULT LogicError : public Error {
155   protected:
156     /** @private @internal
157      *  @brief Constructor for use by constructors of derived classes.
158      */
LogicError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)159     LogicError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
160 	: Error(msg_, context_, type_, error_string_) {}
161 
162     /** @private @internal
163      *  @brief Constructor for use by constructors of derived classes.
164      */
LogicError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)165     LogicError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
166 	: Error(msg_, context_, type_, errno_) {}
167 };
168 
169 /** The base class for exceptions indicating errors only detectable at runtime.
170  *
171  *  A subclass of RuntimeError will be thrown if Xapian detects an error
172  *  which is exception derived from RuntimeError is thrown when an
173  *  error is caused by problems with the data or environment rather
174  *  than a programming mistake.
175  */
176 class XAPIAN_VISIBILITY_DEFAULT RuntimeError : public Error {
177   protected:
178     /** @private @internal
179      *  @brief Constructor for use by constructors of derived classes.
180      */
RuntimeError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)181     RuntimeError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
182 	: Error(msg_, context_, type_, error_string_) {}
183 
184     /** @private @internal
185      *  @brief Constructor for use by constructors of derived classes.
186      */
RuntimeError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)187     RuntimeError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
188 	: Error(msg_, context_, type_, errno_) {}
189 };
190 
191 /** AssertionError is thrown if a logical assertion inside Xapian fails.
192  *
193  *  In a debug build of Xapian, a failed assertion in the core library code
194  *  will cause AssertionError to be thrown.
195  *
196  *  This represents a bug in Xapian (either an invariant, precondition, etc
197  *  has been violated, or the assertion is incorrect!)
198  */
199 class XAPIAN_VISIBILITY_DEFAULT AssertionError : public LogicError {
200   public:
201     /** @private @internal
202      *  @brief Private constructor for use by remote backend.
203      *
204      *  @param error_string_	Optional string describing error.  May be NULL.
205      */
AssertionError(const std::string & msg_,const std::string & context_,const char * error_string_)206     AssertionError(const std::string &msg_, const std::string &context_, const char * error_string_)
207 	: LogicError(msg_, context_, "\000AssertionError", error_string_) {}
208     /** General purpose constructor.
209      *
210      *  @param msg_		Message giving details of the error, intended
211      *				for human consumption.
212      *  @param context_	Optional context information for this error.
213      *  @param errno_		Optional errno value associated with this error.
214      */
215     explicit AssertionError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
216 	: LogicError(msg_, context_, "\000AssertionError", errno_) {}
217     /** Construct from message and errno value.
218      *
219      *  @param msg_		Message giving details of the error, intended
220      *				for human consumption.
221      *  @param errno_		Optional errno value associated with this error.
222      */
AssertionError(const std::string & msg_,int errno_)223     AssertionError(const std::string &msg_, int errno_)
224 	: LogicError(msg_, std::string(), "\000AssertionError", errno_) {}
225   protected:
226     /** @private @internal
227      *  @brief Constructor for use by constructors of derived classes.
228      */
AssertionError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)229     AssertionError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
230 	: LogicError(msg_, context_, type_, error_string_) {}
231 
232     /** @private @internal
233      *  @brief Constructor for use by constructors of derived classes.
234      */
AssertionError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)235     AssertionError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
236 	: LogicError(msg_, context_, type_, errno_) {}
237 };
238 
239 /** InvalidArgumentError indicates an invalid parameter value was passed to the API.
240  */
241 class XAPIAN_VISIBILITY_DEFAULT InvalidArgumentError : public LogicError {
242   public:
243     /** @private @internal
244      *  @brief Private constructor for use by remote backend.
245      *
246      *  @param error_string_	Optional string describing error.  May be NULL.
247      */
InvalidArgumentError(const std::string & msg_,const std::string & context_,const char * error_string_)248     InvalidArgumentError(const std::string &msg_, const std::string &context_, const char * error_string_)
249 	: LogicError(msg_, context_, "\001InvalidArgumentError", error_string_) {}
250     /** General purpose constructor.
251      *
252      *  @param msg_		Message giving details of the error, intended
253      *				for human consumption.
254      *  @param context_	Optional context information for this error.
255      *  @param errno_		Optional errno value associated with this error.
256      */
257     explicit InvalidArgumentError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
258 	: LogicError(msg_, context_, "\001InvalidArgumentError", errno_) {}
259     /** Construct from message and errno value.
260      *
261      *  @param msg_		Message giving details of the error, intended
262      *				for human consumption.
263      *  @param errno_		Optional errno value associated with this error.
264      */
InvalidArgumentError(const std::string & msg_,int errno_)265     InvalidArgumentError(const std::string &msg_, int errno_)
266 	: LogicError(msg_, std::string(), "\001InvalidArgumentError", errno_) {}
267   protected:
268     /** @private @internal
269      *  @brief Constructor for use by constructors of derived classes.
270      */
InvalidArgumentError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)271     InvalidArgumentError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
272 	: LogicError(msg_, context_, type_, error_string_) {}
273 
274     /** @private @internal
275      *  @brief Constructor for use by constructors of derived classes.
276      */
InvalidArgumentError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)277     InvalidArgumentError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
278 	: LogicError(msg_, context_, type_, errno_) {}
279 };
280 
281 /** InvalidOperationError indicates the API was used in an invalid way.
282  */
283 class XAPIAN_VISIBILITY_DEFAULT InvalidOperationError : public LogicError {
284   public:
285     /** @private @internal
286      *  @brief Private constructor for use by remote backend.
287      *
288      *  @param error_string_	Optional string describing error.  May be NULL.
289      */
InvalidOperationError(const std::string & msg_,const std::string & context_,const char * error_string_)290     InvalidOperationError(const std::string &msg_, const std::string &context_, const char * error_string_)
291 	: LogicError(msg_, context_, "\002InvalidOperationError", error_string_) {}
292     /** General purpose constructor.
293      *
294      *  @param msg_		Message giving details of the error, intended
295      *				for human consumption.
296      *  @param context_	Optional context information for this error.
297      *  @param errno_		Optional errno value associated with this error.
298      */
299     explicit InvalidOperationError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
300 	: LogicError(msg_, context_, "\002InvalidOperationError", errno_) {}
301     /** Construct from message and errno value.
302      *
303      *  @param msg_		Message giving details of the error, intended
304      *				for human consumption.
305      *  @param errno_		Optional errno value associated with this error.
306      */
InvalidOperationError(const std::string & msg_,int errno_)307     InvalidOperationError(const std::string &msg_, int errno_)
308 	: LogicError(msg_, std::string(), "\002InvalidOperationError", errno_) {}
309   protected:
310     /** @private @internal
311      *  @brief Constructor for use by constructors of derived classes.
312      */
InvalidOperationError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)313     InvalidOperationError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
314 	: LogicError(msg_, context_, type_, error_string_) {}
315 
316     /** @private @internal
317      *  @brief Constructor for use by constructors of derived classes.
318      */
InvalidOperationError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)319     InvalidOperationError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
320 	: LogicError(msg_, context_, type_, errno_) {}
321 };
322 
323 /** UnimplementedError indicates an attempt to use an unimplemented feature.
324  */
325 class XAPIAN_VISIBILITY_DEFAULT UnimplementedError : public LogicError {
326   public:
327     /** @private @internal
328      *  @brief Private constructor for use by remote backend.
329      *
330      *  @param error_string_	Optional string describing error.  May be NULL.
331      */
UnimplementedError(const std::string & msg_,const std::string & context_,const char * error_string_)332     UnimplementedError(const std::string &msg_, const std::string &context_, const char * error_string_)
333 	: LogicError(msg_, context_, "\003UnimplementedError", error_string_) {}
334     /** General purpose constructor.
335      *
336      *  @param msg_		Message giving details of the error, intended
337      *				for human consumption.
338      *  @param context_	Optional context information for this error.
339      *  @param errno_		Optional errno value associated with this error.
340      */
341     explicit UnimplementedError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
342 	: LogicError(msg_, context_, "\003UnimplementedError", errno_) {}
343     /** Construct from message and errno value.
344      *
345      *  @param msg_		Message giving details of the error, intended
346      *				for human consumption.
347      *  @param errno_		Optional errno value associated with this error.
348      */
UnimplementedError(const std::string & msg_,int errno_)349     UnimplementedError(const std::string &msg_, int errno_)
350 	: LogicError(msg_, std::string(), "\003UnimplementedError", errno_) {}
351   protected:
352     /** @private @internal
353      *  @brief Constructor for use by constructors of derived classes.
354      */
UnimplementedError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)355     UnimplementedError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
356 	: LogicError(msg_, context_, type_, error_string_) {}
357 
358     /** @private @internal
359      *  @brief Constructor for use by constructors of derived classes.
360      */
UnimplementedError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)361     UnimplementedError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
362 	: LogicError(msg_, context_, type_, errno_) {}
363 };
364 
365 /** DatabaseError indicates some sort of database related error.
366  */
367 class XAPIAN_VISIBILITY_DEFAULT DatabaseError : public RuntimeError {
368   public:
369     /** @private @internal
370      *  @brief Private constructor for use by remote backend.
371      *
372      *  @param error_string_	Optional string describing error.  May be NULL.
373      */
DatabaseError(const std::string & msg_,const std::string & context_,const char * error_string_)374     DatabaseError(const std::string &msg_, const std::string &context_, const char * error_string_)
375 	: RuntimeError(msg_, context_, "\004DatabaseError", error_string_) {}
376     /** General purpose constructor.
377      *
378      *  @param msg_		Message giving details of the error, intended
379      *				for human consumption.
380      *  @param context_	Optional context information for this error.
381      *  @param errno_		Optional errno value associated with this error.
382      */
383     explicit DatabaseError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
384 	: RuntimeError(msg_, context_, "\004DatabaseError", errno_) {}
385     /** Construct from message and errno value.
386      *
387      *  @param msg_		Message giving details of the error, intended
388      *				for human consumption.
389      *  @param errno_		Optional errno value associated with this error.
390      */
DatabaseError(const std::string & msg_,int errno_)391     DatabaseError(const std::string &msg_, int errno_)
392 	: RuntimeError(msg_, std::string(), "\004DatabaseError", errno_) {}
393   protected:
394     /** @private @internal
395      *  @brief Constructor for use by constructors of derived classes.
396      */
DatabaseError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)397     DatabaseError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
398 	: RuntimeError(msg_, context_, type_, error_string_) {}
399 
400     /** @private @internal
401      *  @brief Constructor for use by constructors of derived classes.
402      */
DatabaseError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)403     DatabaseError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
404 	: RuntimeError(msg_, context_, type_, errno_) {}
405 };
406 
407 /** DatabaseCorruptError indicates database corruption was detected.
408  */
409 class XAPIAN_VISIBILITY_DEFAULT DatabaseCorruptError : public DatabaseError {
410   public:
411     /** @private @internal
412      *  @brief Private constructor for use by remote backend.
413      *
414      *  @param error_string_	Optional string describing error.  May be NULL.
415      */
DatabaseCorruptError(const std::string & msg_,const std::string & context_,const char * error_string_)416     DatabaseCorruptError(const std::string &msg_, const std::string &context_, const char * error_string_)
417 	: DatabaseError(msg_, context_, "\005DatabaseCorruptError", error_string_) {}
418     /** General purpose constructor.
419      *
420      *  @param msg_		Message giving details of the error, intended
421      *				for human consumption.
422      *  @param context_	Optional context information for this error.
423      *  @param errno_		Optional errno value associated with this error.
424      */
425     explicit DatabaseCorruptError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
426 	: DatabaseError(msg_, context_, "\005DatabaseCorruptError", errno_) {}
427     /** Construct from message and errno value.
428      *
429      *  @param msg_		Message giving details of the error, intended
430      *				for human consumption.
431      *  @param errno_		Optional errno value associated with this error.
432      */
DatabaseCorruptError(const std::string & msg_,int errno_)433     DatabaseCorruptError(const std::string &msg_, int errno_)
434 	: DatabaseError(msg_, std::string(), "\005DatabaseCorruptError", errno_) {}
435   protected:
436     /** @private @internal
437      *  @brief Constructor for use by constructors of derived classes.
438      */
DatabaseCorruptError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)439     DatabaseCorruptError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
440 	: DatabaseError(msg_, context_, type_, error_string_) {}
441 
442     /** @private @internal
443      *  @brief Constructor for use by constructors of derived classes.
444      */
DatabaseCorruptError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)445     DatabaseCorruptError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
446 	: DatabaseError(msg_, context_, type_, errno_) {}
447 };
448 
449 /** DatabaseCreateError indicates a failure to create a database.
450  */
451 class XAPIAN_VISIBILITY_DEFAULT DatabaseCreateError : public DatabaseError {
452   public:
453     /** @private @internal
454      *  @brief Private constructor for use by remote backend.
455      *
456      *  @param error_string_	Optional string describing error.  May be NULL.
457      */
DatabaseCreateError(const std::string & msg_,const std::string & context_,const char * error_string_)458     DatabaseCreateError(const std::string &msg_, const std::string &context_, const char * error_string_)
459 	: DatabaseError(msg_, context_, "\006DatabaseCreateError", error_string_) {}
460     /** General purpose constructor.
461      *
462      *  @param msg_		Message giving details of the error, intended
463      *				for human consumption.
464      *  @param context_	Optional context information for this error.
465      *  @param errno_		Optional errno value associated with this error.
466      */
467     explicit DatabaseCreateError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
468 	: DatabaseError(msg_, context_, "\006DatabaseCreateError", errno_) {}
469     /** Construct from message and errno value.
470      *
471      *  @param msg_		Message giving details of the error, intended
472      *				for human consumption.
473      *  @param errno_		Optional errno value associated with this error.
474      */
DatabaseCreateError(const std::string & msg_,int errno_)475     DatabaseCreateError(const std::string &msg_, int errno_)
476 	: DatabaseError(msg_, std::string(), "\006DatabaseCreateError", errno_) {}
477   protected:
478     /** @private @internal
479      *  @brief Constructor for use by constructors of derived classes.
480      */
DatabaseCreateError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)481     DatabaseCreateError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
482 	: DatabaseError(msg_, context_, type_, error_string_) {}
483 
484     /** @private @internal
485      *  @brief Constructor for use by constructors of derived classes.
486      */
DatabaseCreateError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)487     DatabaseCreateError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
488 	: DatabaseError(msg_, context_, type_, errno_) {}
489 };
490 
491 /** DatabaseLockError indicates failure to lock a database.
492  */
493 class XAPIAN_VISIBILITY_DEFAULT DatabaseLockError : public DatabaseError {
494   public:
495     /** @private @internal
496      *  @brief Private constructor for use by remote backend.
497      *
498      *  @param error_string_	Optional string describing error.  May be NULL.
499      */
DatabaseLockError(const std::string & msg_,const std::string & context_,const char * error_string_)500     DatabaseLockError(const std::string &msg_, const std::string &context_, const char * error_string_)
501 	: DatabaseError(msg_, context_, "\007DatabaseLockError", error_string_) {}
502     /** General purpose constructor.
503      *
504      *  @param msg_		Message giving details of the error, intended
505      *				for human consumption.
506      *  @param context_	Optional context information for this error.
507      *  @param errno_		Optional errno value associated with this error.
508      */
509     explicit DatabaseLockError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
510 	: DatabaseError(msg_, context_, "\007DatabaseLockError", errno_) {}
511     /** Construct from message and errno value.
512      *
513      *  @param msg_		Message giving details of the error, intended
514      *				for human consumption.
515      *  @param errno_		Optional errno value associated with this error.
516      */
DatabaseLockError(const std::string & msg_,int errno_)517     DatabaseLockError(const std::string &msg_, int errno_)
518 	: DatabaseError(msg_, std::string(), "\007DatabaseLockError", errno_) {}
519   protected:
520     /** @private @internal
521      *  @brief Constructor for use by constructors of derived classes.
522      */
DatabaseLockError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)523     DatabaseLockError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
524 	: DatabaseError(msg_, context_, type_, error_string_) {}
525 
526     /** @private @internal
527      *  @brief Constructor for use by constructors of derived classes.
528      */
DatabaseLockError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)529     DatabaseLockError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
530 	: DatabaseError(msg_, context_, type_, errno_) {}
531 };
532 
533 /** DatabaseModifiedError indicates a database was modified.
534  *
535  *  To recover after catching this error, you need to call
536  *  Xapian::Database::reopen() on the Database and repeat the operation
537  *  which failed.
538  */
539 class XAPIAN_VISIBILITY_DEFAULT DatabaseModifiedError : public DatabaseError {
540   public:
541     /** @private @internal
542      *  @brief Private constructor for use by remote backend.
543      *
544      *  @param error_string_	Optional string describing error.  May be NULL.
545      */
DatabaseModifiedError(const std::string & msg_,const std::string & context_,const char * error_string_)546     DatabaseModifiedError(const std::string &msg_, const std::string &context_, const char * error_string_)
547 	: DatabaseError(msg_, context_, "\010DatabaseModifiedError", error_string_) {}
548     /** General purpose constructor.
549      *
550      *  @param msg_		Message giving details of the error, intended
551      *				for human consumption.
552      *  @param context_	Optional context information for this error.
553      *  @param errno_		Optional errno value associated with this error.
554      */
555     explicit DatabaseModifiedError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
556 	: DatabaseError(msg_, context_, "\010DatabaseModifiedError", errno_) {}
557     /** Construct from message and errno value.
558      *
559      *  @param msg_		Message giving details of the error, intended
560      *				for human consumption.
561      *  @param errno_		Optional errno value associated with this error.
562      */
DatabaseModifiedError(const std::string & msg_,int errno_)563     DatabaseModifiedError(const std::string &msg_, int errno_)
564 	: DatabaseError(msg_, std::string(), "\010DatabaseModifiedError", errno_) {}
565   protected:
566     /** @private @internal
567      *  @brief Constructor for use by constructors of derived classes.
568      */
DatabaseModifiedError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)569     DatabaseModifiedError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
570 	: DatabaseError(msg_, context_, type_, error_string_) {}
571 
572     /** @private @internal
573      *  @brief Constructor for use by constructors of derived classes.
574      */
DatabaseModifiedError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)575     DatabaseModifiedError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
576 	: DatabaseError(msg_, context_, type_, errno_) {}
577 };
578 
579 /** DatabaseOpeningError indicates failure to open a database.
580  */
581 class XAPIAN_VISIBILITY_DEFAULT DatabaseOpeningError : public DatabaseError {
582   public:
583     /** @private @internal
584      *  @brief Private constructor for use by remote backend.
585      *
586      *  @param error_string_	Optional string describing error.  May be NULL.
587      */
DatabaseOpeningError(const std::string & msg_,const std::string & context_,const char * error_string_)588     DatabaseOpeningError(const std::string &msg_, const std::string &context_, const char * error_string_)
589 	: DatabaseError(msg_, context_, "\011DatabaseOpeningError", error_string_) {}
590     /** General purpose constructor.
591      *
592      *  @param msg_		Message giving details of the error, intended
593      *				for human consumption.
594      *  @param context_	Optional context information for this error.
595      *  @param errno_		Optional errno value associated with this error.
596      */
597     explicit DatabaseOpeningError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
598 	: DatabaseError(msg_, context_, "\011DatabaseOpeningError", errno_) {}
599     /** Construct from message and errno value.
600      *
601      *  @param msg_		Message giving details of the error, intended
602      *				for human consumption.
603      *  @param errno_		Optional errno value associated with this error.
604      */
DatabaseOpeningError(const std::string & msg_,int errno_)605     DatabaseOpeningError(const std::string &msg_, int errno_)
606 	: DatabaseError(msg_, std::string(), "\011DatabaseOpeningError", errno_) {}
607   protected:
608     /** @private @internal
609      *  @brief Constructor for use by constructors of derived classes.
610      */
DatabaseOpeningError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)611     DatabaseOpeningError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
612 	: DatabaseError(msg_, context_, type_, error_string_) {}
613 
614     /** @private @internal
615      *  @brief Constructor for use by constructors of derived classes.
616      */
DatabaseOpeningError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)617     DatabaseOpeningError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
618 	: DatabaseError(msg_, context_, type_, errno_) {}
619 };
620 
621 /** DatabaseVersionError indicates that a database is in an unsupported format.
622  *
623  *  From time to time, new versions of Xapian will require the database format
624  *  to be changed, to allow new information to be stored or new optimisations
625  *  to be performed.  Backwards compatibility will sometimes be maintained, so
626  *  that new versions of Xapian can open old databases, but in some cases
627  *  Xapian will be unable to open a database because it is in too old (or new)
628  *  a format.  This can be resolved either be upgrading or downgrading the
629  *  version of Xapian in use, or by rebuilding the database from scratch with
630  *  the current version of Xapian.
631  */
632 class XAPIAN_VISIBILITY_DEFAULT DatabaseVersionError : public DatabaseOpeningError {
633   public:
634     /** @private @internal
635      *  @brief Private constructor for use by remote backend.
636      *
637      *  @param error_string_	Optional string describing error.  May be NULL.
638      */
DatabaseVersionError(const std::string & msg_,const std::string & context_,const char * error_string_)639     DatabaseVersionError(const std::string &msg_, const std::string &context_, const char * error_string_)
640 	: DatabaseOpeningError(msg_, context_, "\012DatabaseVersionError", error_string_) {}
641     /** General purpose constructor.
642      *
643      *  @param msg_		Message giving details of the error, intended
644      *				for human consumption.
645      *  @param context_	Optional context information for this error.
646      *  @param errno_		Optional errno value associated with this error.
647      */
648     explicit DatabaseVersionError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
649 	: DatabaseOpeningError(msg_, context_, "\012DatabaseVersionError", errno_) {}
650     /** Construct from message and errno value.
651      *
652      *  @param msg_		Message giving details of the error, intended
653      *				for human consumption.
654      *  @param errno_		Optional errno value associated with this error.
655      */
DatabaseVersionError(const std::string & msg_,int errno_)656     DatabaseVersionError(const std::string &msg_, int errno_)
657 	: DatabaseOpeningError(msg_, std::string(), "\012DatabaseVersionError", errno_) {}
658   protected:
659     /** @private @internal
660      *  @brief Constructor for use by constructors of derived classes.
661      */
DatabaseVersionError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)662     DatabaseVersionError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
663 	: DatabaseOpeningError(msg_, context_, type_, error_string_) {}
664 
665     /** @private @internal
666      *  @brief Constructor for use by constructors of derived classes.
667      */
DatabaseVersionError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)668     DatabaseVersionError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
669 	: DatabaseOpeningError(msg_, context_, type_, errno_) {}
670 };
671 
672 /** Indicates an attempt to access a document not present in the database.
673  */
674 class XAPIAN_VISIBILITY_DEFAULT DocNotFoundError : public RuntimeError {
675   public:
676     /** @private @internal
677      *  @brief Private constructor for use by remote backend.
678      *
679      *  @param error_string_	Optional string describing error.  May be NULL.
680      */
DocNotFoundError(const std::string & msg_,const std::string & context_,const char * error_string_)681     DocNotFoundError(const std::string &msg_, const std::string &context_, const char * error_string_)
682 	: RuntimeError(msg_, context_, "\013DocNotFoundError", error_string_) {}
683     /** General purpose constructor.
684      *
685      *  @param msg_		Message giving details of the error, intended
686      *				for human consumption.
687      *  @param context_	Optional context information for this error.
688      *  @param errno_		Optional errno value associated with this error.
689      */
690     explicit DocNotFoundError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
691 	: RuntimeError(msg_, context_, "\013DocNotFoundError", errno_) {}
692     /** Construct from message and errno value.
693      *
694      *  @param msg_		Message giving details of the error, intended
695      *				for human consumption.
696      *  @param errno_		Optional errno value associated with this error.
697      */
DocNotFoundError(const std::string & msg_,int errno_)698     DocNotFoundError(const std::string &msg_, int errno_)
699 	: RuntimeError(msg_, std::string(), "\013DocNotFoundError", errno_) {}
700   protected:
701     /** @private @internal
702      *  @brief Constructor for use by constructors of derived classes.
703      */
DocNotFoundError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)704     DocNotFoundError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
705 	: RuntimeError(msg_, context_, type_, error_string_) {}
706 
707     /** @private @internal
708      *  @brief Constructor for use by constructors of derived classes.
709      */
DocNotFoundError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)710     DocNotFoundError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
711 	: RuntimeError(msg_, context_, type_, errno_) {}
712 };
713 
714 /** Indicates an attempt to use a feature which is unavailable.
715  *
716  *  Typically a feature is unavailable because it wasn't compiled in, or
717  *  because it requires other software or facilities which aren't available.
718  */
719 class XAPIAN_VISIBILITY_DEFAULT FeatureUnavailableError : public RuntimeError {
720   public:
721     /** @private @internal
722      *  @brief Private constructor for use by remote backend.
723      *
724      *  @param error_string_	Optional string describing error.  May be NULL.
725      */
FeatureUnavailableError(const std::string & msg_,const std::string & context_,const char * error_string_)726     FeatureUnavailableError(const std::string &msg_, const std::string &context_, const char * error_string_)
727 	: RuntimeError(msg_, context_, "\014FeatureUnavailableError", error_string_) {}
728     /** General purpose constructor.
729      *
730      *  @param msg_		Message giving details of the error, intended
731      *				for human consumption.
732      *  @param context_	Optional context information for this error.
733      *  @param errno_		Optional errno value associated with this error.
734      */
735     explicit FeatureUnavailableError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
736 	: RuntimeError(msg_, context_, "\014FeatureUnavailableError", errno_) {}
737     /** Construct from message and errno value.
738      *
739      *  @param msg_		Message giving details of the error, intended
740      *				for human consumption.
741      *  @param errno_		Optional errno value associated with this error.
742      */
FeatureUnavailableError(const std::string & msg_,int errno_)743     FeatureUnavailableError(const std::string &msg_, int errno_)
744 	: RuntimeError(msg_, std::string(), "\014FeatureUnavailableError", errno_) {}
745   protected:
746     /** @private @internal
747      *  @brief Constructor for use by constructors of derived classes.
748      */
FeatureUnavailableError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)749     FeatureUnavailableError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
750 	: RuntimeError(msg_, context_, type_, error_string_) {}
751 
752     /** @private @internal
753      *  @brief Constructor for use by constructors of derived classes.
754      */
FeatureUnavailableError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)755     FeatureUnavailableError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
756 	: RuntimeError(msg_, context_, type_, errno_) {}
757 };
758 
759 /** InternalError indicates a runtime problem of some sort.
760  */
761 class XAPIAN_VISIBILITY_DEFAULT InternalError : public RuntimeError {
762   public:
763     /** @private @internal
764      *  @brief Private constructor for use by remote backend.
765      *
766      *  @param error_string_	Optional string describing error.  May be NULL.
767      */
InternalError(const std::string & msg_,const std::string & context_,const char * error_string_)768     InternalError(const std::string &msg_, const std::string &context_, const char * error_string_)
769 	: RuntimeError(msg_, context_, "\015InternalError", error_string_) {}
770     /** General purpose constructor.
771      *
772      *  @param msg_		Message giving details of the error, intended
773      *				for human consumption.
774      *  @param context_	Optional context information for this error.
775      *  @param errno_		Optional errno value associated with this error.
776      */
777     explicit InternalError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
778 	: RuntimeError(msg_, context_, "\015InternalError", errno_) {}
779     /** Construct from message and errno value.
780      *
781      *  @param msg_		Message giving details of the error, intended
782      *				for human consumption.
783      *  @param errno_		Optional errno value associated with this error.
784      */
InternalError(const std::string & msg_,int errno_)785     InternalError(const std::string &msg_, int errno_)
786 	: RuntimeError(msg_, std::string(), "\015InternalError", errno_) {}
787   protected:
788     /** @private @internal
789      *  @brief Constructor for use by constructors of derived classes.
790      */
InternalError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)791     InternalError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
792 	: RuntimeError(msg_, context_, type_, error_string_) {}
793 
794     /** @private @internal
795      *  @brief Constructor for use by constructors of derived classes.
796      */
InternalError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)797     InternalError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
798 	: RuntimeError(msg_, context_, type_, errno_) {}
799 };
800 
801 /** Indicates a problem communicating with a remote database.
802  */
803 class XAPIAN_VISIBILITY_DEFAULT NetworkError : public RuntimeError {
804   public:
805     /** @private @internal
806      *  @brief Private constructor for use by remote backend.
807      *
808      *  @param error_string_	Optional string describing error.  May be NULL.
809      */
NetworkError(const std::string & msg_,const std::string & context_,const char * error_string_)810     NetworkError(const std::string &msg_, const std::string &context_, const char * error_string_)
811 	: RuntimeError(msg_, context_, "\016NetworkError", error_string_) {}
812     /** General purpose constructor.
813      *
814      *  @param msg_		Message giving details of the error, intended
815      *				for human consumption.
816      *  @param context_	Optional context information for this error.
817      *  @param errno_		Optional errno value associated with this error.
818      */
819     explicit NetworkError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
820 	: RuntimeError(msg_, context_, "\016NetworkError", errno_) {}
821     /** Construct from message and errno value.
822      *
823      *  @param msg_		Message giving details of the error, intended
824      *				for human consumption.
825      *  @param errno_		Optional errno value associated with this error.
826      */
NetworkError(const std::string & msg_,int errno_)827     NetworkError(const std::string &msg_, int errno_)
828 	: RuntimeError(msg_, std::string(), "\016NetworkError", errno_) {}
829   protected:
830     /** @private @internal
831      *  @brief Constructor for use by constructors of derived classes.
832      */
NetworkError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)833     NetworkError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
834 	: RuntimeError(msg_, context_, type_, error_string_) {}
835 
836     /** @private @internal
837      *  @brief Constructor for use by constructors of derived classes.
838      */
NetworkError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)839     NetworkError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
840 	: RuntimeError(msg_, context_, type_, errno_) {}
841 };
842 
843 /** Indicates a timeout expired while communicating with a remote database.
844  */
845 class XAPIAN_VISIBILITY_DEFAULT NetworkTimeoutError : public NetworkError {
846   public:
847     /** @private @internal
848      *  @brief Private constructor for use by remote backend.
849      *
850      *  @param error_string_	Optional string describing error.  May be NULL.
851      */
NetworkTimeoutError(const std::string & msg_,const std::string & context_,const char * error_string_)852     NetworkTimeoutError(const std::string &msg_, const std::string &context_, const char * error_string_)
853 	: NetworkError(msg_, context_, "\017NetworkTimeoutError", error_string_) {}
854     /** General purpose constructor.
855      *
856      *  @param msg_		Message giving details of the error, intended
857      *				for human consumption.
858      *  @param context_	Optional context information for this error.
859      *  @param errno_		Optional errno value associated with this error.
860      */
861     explicit NetworkTimeoutError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
862 	: NetworkError(msg_, context_, "\017NetworkTimeoutError", errno_) {}
863     /** Construct from message and errno value.
864      *
865      *  @param msg_		Message giving details of the error, intended
866      *				for human consumption.
867      *  @param errno_		Optional errno value associated with this error.
868      */
NetworkTimeoutError(const std::string & msg_,int errno_)869     NetworkTimeoutError(const std::string &msg_, int errno_)
870 	: NetworkError(msg_, std::string(), "\017NetworkTimeoutError", errno_) {}
871   protected:
872     /** @private @internal
873      *  @brief Constructor for use by constructors of derived classes.
874      */
NetworkTimeoutError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)875     NetworkTimeoutError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
876 	: NetworkError(msg_, context_, type_, error_string_) {}
877 
878     /** @private @internal
879      *  @brief Constructor for use by constructors of derived classes.
880      */
NetworkTimeoutError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)881     NetworkTimeoutError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
882 	: NetworkError(msg_, context_, type_, errno_) {}
883 };
884 
885 /** Indicates a query string can't be parsed.
886  */
887 class XAPIAN_VISIBILITY_DEFAULT QueryParserError : public RuntimeError {
888   public:
889     /** @private @internal
890      *  @brief Private constructor for use by remote backend.
891      *
892      *  @param error_string_	Optional string describing error.  May be NULL.
893      */
QueryParserError(const std::string & msg_,const std::string & context_,const char * error_string_)894     QueryParserError(const std::string &msg_, const std::string &context_, const char * error_string_)
895 	: RuntimeError(msg_, context_, "\020QueryParserError", error_string_) {}
896     /** General purpose constructor.
897      *
898      *  @param msg_		Message giving details of the error, intended
899      *				for human consumption.
900      *  @param context_	Optional context information for this error.
901      *  @param errno_		Optional errno value associated with this error.
902      */
903     explicit QueryParserError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
904 	: RuntimeError(msg_, context_, "\020QueryParserError", errno_) {}
905     /** Construct from message and errno value.
906      *
907      *  @param msg_		Message giving details of the error, intended
908      *				for human consumption.
909      *  @param errno_		Optional errno value associated with this error.
910      */
QueryParserError(const std::string & msg_,int errno_)911     QueryParserError(const std::string &msg_, int errno_)
912 	: RuntimeError(msg_, std::string(), "\020QueryParserError", errno_) {}
913   protected:
914     /** @private @internal
915      *  @brief Constructor for use by constructors of derived classes.
916      */
QueryParserError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)917     QueryParserError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
918 	: RuntimeError(msg_, context_, type_, error_string_) {}
919 
920     /** @private @internal
921      *  @brief Constructor for use by constructors of derived classes.
922      */
QueryParserError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)923     QueryParserError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
924 	: RuntimeError(msg_, context_, type_, errno_) {}
925 };
926 
927 /** Indicates an error in the std::string serialisation of an object.
928  */
929 class XAPIAN_VISIBILITY_DEFAULT SerialisationError : public RuntimeError {
930   public:
931     /** @private @internal
932      *  @brief Private constructor for use by remote backend.
933      *
934      *  @param error_string_	Optional string describing error.  May be NULL.
935      */
SerialisationError(const std::string & msg_,const std::string & context_,const char * error_string_)936     SerialisationError(const std::string &msg_, const std::string &context_, const char * error_string_)
937 	: RuntimeError(msg_, context_, "\021SerialisationError", error_string_) {}
938     /** General purpose constructor.
939      *
940      *  @param msg_		Message giving details of the error, intended
941      *				for human consumption.
942      *  @param context_	Optional context information for this error.
943      *  @param errno_		Optional errno value associated with this error.
944      */
945     explicit SerialisationError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
946 	: RuntimeError(msg_, context_, "\021SerialisationError", errno_) {}
947     /** Construct from message and errno value.
948      *
949      *  @param msg_		Message giving details of the error, intended
950      *				for human consumption.
951      *  @param errno_		Optional errno value associated with this error.
952      */
SerialisationError(const std::string & msg_,int errno_)953     SerialisationError(const std::string &msg_, int errno_)
954 	: RuntimeError(msg_, std::string(), "\021SerialisationError", errno_) {}
955   protected:
956     /** @private @internal
957      *  @brief Constructor for use by constructors of derived classes.
958      */
SerialisationError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)959     SerialisationError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
960 	: RuntimeError(msg_, context_, type_, error_string_) {}
961 
962     /** @private @internal
963      *  @brief Constructor for use by constructors of derived classes.
964      */
SerialisationError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)965     SerialisationError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
966 	: RuntimeError(msg_, context_, type_, errno_) {}
967 };
968 
969 /** RangeError indicates an attempt to access outside the bounds of a container.
970  */
971 class XAPIAN_VISIBILITY_DEFAULT RangeError : public RuntimeError {
972   public:
973     /** @private @internal
974      *  @brief Private constructor for use by remote backend.
975      *
976      *  @param error_string_	Optional string describing error.  May be NULL.
977      */
RangeError(const std::string & msg_,const std::string & context_,const char * error_string_)978     RangeError(const std::string &msg_, const std::string &context_, const char * error_string_)
979 	: RuntimeError(msg_, context_, "\022RangeError", error_string_) {}
980     /** General purpose constructor.
981      *
982      *  @param msg_		Message giving details of the error, intended
983      *				for human consumption.
984      *  @param context_	Optional context information for this error.
985      *  @param errno_		Optional errno value associated with this error.
986      */
987     explicit RangeError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
988 	: RuntimeError(msg_, context_, "\022RangeError", errno_) {}
989     /** Construct from message and errno value.
990      *
991      *  @param msg_		Message giving details of the error, intended
992      *				for human consumption.
993      *  @param errno_		Optional errno value associated with this error.
994      */
RangeError(const std::string & msg_,int errno_)995     RangeError(const std::string &msg_, int errno_)
996 	: RuntimeError(msg_, std::string(), "\022RangeError", errno_) {}
997   protected:
998     /** @private @internal
999      *  @brief Constructor for use by constructors of derived classes.
1000      */
RangeError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)1001     RangeError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
1002 	: RuntimeError(msg_, context_, type_, error_string_) {}
1003 
1004     /** @private @internal
1005      *  @brief Constructor for use by constructors of derived classes.
1006      */
RangeError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)1007     RangeError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
1008 	: RuntimeError(msg_, context_, type_, errno_) {}
1009 };
1010 
1011 /** WildcardError indicates an error expanding a wildcarded query.
1012  */
1013 class XAPIAN_VISIBILITY_DEFAULT WildcardError : public RuntimeError {
1014   public:
1015     /** @private @internal
1016      *  @brief Private constructor for use by remote backend.
1017      *
1018      *  @param error_string_	Optional string describing error.  May be NULL.
1019      */
WildcardError(const std::string & msg_,const std::string & context_,const char * error_string_)1020     WildcardError(const std::string &msg_, const std::string &context_, const char * error_string_)
1021 	: RuntimeError(msg_, context_, "\023WildcardError", error_string_) {}
1022     /** General purpose constructor.
1023      *
1024      *  @param msg_		Message giving details of the error, intended
1025      *				for human consumption.
1026      *  @param context_	Optional context information for this error.
1027      *  @param errno_		Optional errno value associated with this error.
1028      */
1029     explicit WildcardError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
1030 	: RuntimeError(msg_, context_, "\023WildcardError", errno_) {}
1031     /** Construct from message and errno value.
1032      *
1033      *  @param msg_		Message giving details of the error, intended
1034      *				for human consumption.
1035      *  @param errno_		Optional errno value associated with this error.
1036      */
WildcardError(const std::string & msg_,int errno_)1037     WildcardError(const std::string &msg_, int errno_)
1038 	: RuntimeError(msg_, std::string(), "\023WildcardError", errno_) {}
1039   protected:
1040     /** @private @internal
1041      *  @brief Constructor for use by constructors of derived classes.
1042      */
WildcardError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)1043     WildcardError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
1044 	: RuntimeError(msg_, context_, type_, error_string_) {}
1045 
1046     /** @private @internal
1047      *  @brief Constructor for use by constructors of derived classes.
1048      */
WildcardError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)1049     WildcardError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
1050 	: RuntimeError(msg_, context_, type_, errno_) {}
1051 };
1052 
1053 /** Indicates an attempt to access a database not present.
1054  */
1055 class XAPIAN_VISIBILITY_DEFAULT DatabaseNotFoundError : public DatabaseOpeningError {
1056   public:
1057     /** @private @internal
1058      *  @brief Private constructor for use by remote backend.
1059      *
1060      *  @param error_string_	Optional string describing error.  May be NULL.
1061      */
DatabaseNotFoundError(const std::string & msg_,const std::string & context_,const char * error_string_)1062     DatabaseNotFoundError(const std::string &msg_, const std::string &context_, const char * error_string_)
1063 	: DatabaseOpeningError(msg_, context_, "\024DatabaseNotFoundError", error_string_) {}
1064     /** General purpose constructor.
1065      *
1066      *  @param msg_		Message giving details of the error, intended
1067      *				for human consumption.
1068      *  @param context_	Optional context information for this error.
1069      *  @param errno_		Optional errno value associated with this error.
1070      */
1071     explicit DatabaseNotFoundError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
1072 	: DatabaseOpeningError(msg_, context_, "\024DatabaseNotFoundError", errno_) {}
1073     /** Construct from message and errno value.
1074      *
1075      *  @param msg_		Message giving details of the error, intended
1076      *				for human consumption.
1077      *  @param errno_		Optional errno value associated with this error.
1078      */
DatabaseNotFoundError(const std::string & msg_,int errno_)1079     DatabaseNotFoundError(const std::string &msg_, int errno_)
1080 	: DatabaseOpeningError(msg_, std::string(), "\024DatabaseNotFoundError", errno_) {}
1081   protected:
1082     /** @private @internal
1083      *  @brief Constructor for use by constructors of derived classes.
1084      */
DatabaseNotFoundError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)1085     DatabaseNotFoundError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
1086 	: DatabaseOpeningError(msg_, context_, type_, error_string_) {}
1087 
1088     /** @private @internal
1089      *  @brief Constructor for use by constructors of derived classes.
1090      */
DatabaseNotFoundError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)1091     DatabaseNotFoundError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
1092 	: DatabaseOpeningError(msg_, context_, type_, errno_) {}
1093 };
1094 
1095 /** Indicates an attempt to access a closed database.
1096  */
1097 class XAPIAN_VISIBILITY_DEFAULT DatabaseClosedError : public DatabaseError {
1098   public:
1099     /** @private @internal
1100      *  @brief Private constructor for use by remote backend.
1101      *
1102      *  @param error_string_	Optional string describing error.  May be NULL.
1103      */
DatabaseClosedError(const std::string & msg_,const std::string & context_,const char * error_string_)1104     DatabaseClosedError(const std::string &msg_, const std::string &context_, const char * error_string_)
1105 	: DatabaseError(msg_, context_, "\025DatabaseClosedError", error_string_) {}
1106     /** General purpose constructor.
1107      *
1108      *  @param msg_		Message giving details of the error, intended
1109      *				for human consumption.
1110      *  @param context_	Optional context information for this error.
1111      *  @param errno_		Optional errno value associated with this error.
1112      */
1113     explicit DatabaseClosedError(const std::string &msg_, const std::string &context_ = std::string(), int errno_ = 0)
1114 	: DatabaseError(msg_, context_, "\025DatabaseClosedError", errno_) {}
1115     /** Construct from message and errno value.
1116      *
1117      *  @param msg_		Message giving details of the error, intended
1118      *				for human consumption.
1119      *  @param errno_		Optional errno value associated with this error.
1120      */
DatabaseClosedError(const std::string & msg_,int errno_)1121     DatabaseClosedError(const std::string &msg_, int errno_)
1122 	: DatabaseError(msg_, std::string(), "\025DatabaseClosedError", errno_) {}
1123   protected:
1124     /** @private @internal
1125      *  @brief Constructor for use by constructors of derived classes.
1126      */
DatabaseClosedError(const std::string & msg_,const std::string & context_,const char * type_,const char * error_string_)1127     DatabaseClosedError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
1128 	: DatabaseError(msg_, context_, type_, error_string_) {}
1129 
1130     /** @private @internal
1131      *  @brief Constructor for use by constructors of derived classes.
1132      */
DatabaseClosedError(const std::string & msg_,const std::string & context_,const char * type_,int errno_)1133     DatabaseClosedError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
1134 	: DatabaseError(msg_, context_, type_, errno_) {}
1135 };
1136 
1137 }
1138 
1139 #endif /* XAPIAN_INCLUDED_ERROR_H */
1140