LCOV - code coverage report
Current view: top level - include/xapian - error.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core fcfb185a9dd5 Lines: 101 151 66.9 %
Date: 2019-04-18 16:33:14 Functions: 65 92 70.7 %
Branches: 8 20 40.0 %

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

Generated by: LCOV version 1.11