LTP GCOV extension - code coverage report
Current view: | directory - usr/include/xapian - error.h
Test: | lcov.info
Date: | 2008-08-14 |  | Instrumented lines: | 3
Code covered: | 0.0 % |  | Executed lines: | 0

           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 Olly Betts
           6                 :  *
           7                 :  * This program is free software; you can redistribute it and/or
           8                 :  * modify it under the terms of the GNU General Public License as
           9                 :  * published by the Free Software Foundation; either version 2 of the
          10                 :  * License, or (at your option) any later version.
          11                 :  *
          12                 :  * This program is distributed in the hope that it will be useful,
          13                 :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
          14                 :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
          15                 :  * GNU General Public License for more details.
          16                 :  *
          17                 :  * You should have received a copy of the GNU General Public License
          18                 :  * along with this program; if not, write to the Free Software
          19                 :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
          20                 :  */
          21                 :
          22                 : #ifndef XAPIAN_INCLUDED_ERROR_H
          23                 : #define XAPIAN_INCLUDED_ERROR_H
          24                 :
          25                 : #include <string>
          26                 : #include <xapian/deprecated.h>
          27                 : #include <xapian/visibility.h>
          28                 :
          29                 : namespace Xapian {
          30                 :
          31                 : class ErrorHandler;
          32                 :
          33                 : /** All exceptions thrown by Xapian are subclasses of Xapian::Error.
          34                 :  *
          35                 :  *  This class can not be instantiated directly - instead a subclass should
          36                 :  *  be used.
          37                 :  */
          38                 : class XAPIAN_VISIBILITY_DEFAULT Error {
          39                 :     // ErrorHandler needs to be able to access Error::already_handled.
          40                 :     friend class ErrorHandler;
          41                 :
          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 use by Xapian::ErrorHandler (for example
          48                 :      *  so it can know which remote server is unreliable and report the problem
          49                 :      *  and remove that server from those being searched).  But it's typically
          50                 :      *  a plain-text string, and so also fit for human consumption.
          51                 :      */
          52                 :     std::string context;
          53                 :
          54                 :     /// The type of this error (e.g. DocNotFoundError.)
          55                 :     const char * type;
          56                 :
          57                 :     /** Optional value of 'errno' associated with this error.
          58                 :      *
          59                 :      *  If no value is associated, this member variable will be 0.
          60                 :      *
          61                 :      *  On UNIX, if this value is < 0, it's a negated h_errno value (giving
          62                 :      *  an error from gethostbyname() or similar).
          63                 :      *
          64                 :      *  On Windows, if this value is < 0, it's a negated Windows error code
          65                 :      *  (as given by GetLastError() or WSAGetLastError()).
          66                 :      *
          67                 :      *  NB We don't just call this member "errno" to avoid problems on
          68                 :      *  platforms where errno is a preprocessor macro.
          69                 :      */
          70                 :     int my_errno;
          71                 :
          72                 :     /** The error string derived from my_errno.
          73                 :      *
          74                 :      *  This string is generated from my_errno lazily.
          75                 :      */
          76                 :     mutable std::string error_string;
          77                 :
          78                 :     /// True if this error has already been passed to an ErrorHandler.
          79                 :     bool already_handled;
          80                 :
          81                 :     /// Don't allow assignment of the base class.
          82                 :     void operator=(const Error &o);
          83                 :
          84                 :   protected:
          85                 :     /** @private @internal
          86                 :      *  @brief Constructor for use by constructors of derived classes.
          87                 :      */
          88                 :     Error(const std::string &msg_, const std::string &context_,
          89                 :           const char * type_, const char * error_string_);
          90                 :
          91                 :     /** @private @internal
          92                 :      *  @brief Constructor for use by constructors of derived classes.
          93                 :      */
          94                 :     Error(const std::string &msg_, const std::string &context_,
          95                 :           const char * type_, int errno_)
          96                 :         : msg(msg_), context(context_), type(type_), my_errno(errno_),
          97                 :           error_string(), already_handled(false) { }
          98                 :
          99                 :   public:
         100                 :     /// The type of this error (e.g. "DocNotFoundError".)
         101               0 :     const char * get_type() const { return type; }
         102                 :
         103                 :     /// Message giving details of the error, intended for human consumption.
         104               0 :     const std::string & get_msg() const { return msg; }
         105                 :
         106                 :     /** Optional context information.
         107                 :      *
         108                 :      *  This context is intended for use by Xapian::ErrorHandler (for example
         109                 :      *  so it can know which remote server is unreliable and report the problem
         110                 :      *  and remove that server from those being searched).  But it's typically
         111                 :      *  a plain-text string, and so also fit for human consumption.
         112                 :      */
         113               0 :     const std::string & get_context() const { return context; }
         114                 :
         115                 :     /** Returns any system error string associated with this exception.
         116                 :      *
         117                 :      *  The system error string may come from errno, h_errno (on UNIX), or
         118                 :      *  GetLastError() (on MS Windows).  If there is no associated system
         119                 :      *  error string, NULL is returned.
         120                 :      */
         121                 :     const char * get_error_string() const;
         122                 :
         123                 :     /** Optional value of 'errno' associated with this error.
         124                 :      *
         125                 :      *  If no 'errno' value is associated, returns 0.  If the returned value
         126                 :      *  is negative, it's a platform-specific error code (on UNIX, -h_errno;
         127                 :      *  on MS Windows, -GetLastError()).
         128                 :      *
         129                 :      *  @deprecated This method is deprecated, because errno values aren't
         130                 :      *  portable between platforms, so we can't serialise them when passing
         131                 :      *  exceptions from a remote server to a client.  Use the
         132                 :      *  get_error_string() method instead.
         133                 :      */
         134                 :     XAPIAN_DEPRECATED(int get_errno() const);
         135                 :
         136                 :     /// Return a string describing this object.
         137                 :     std::string get_description() const;
         138                 : };
         139                 :
         140                 : inline int Xapian::Error::get_errno() const { return my_errno; }
         141                 :
         142                 : /** The base class for exceptions indicating errors in the program logic.
         143                 :  *
         144                 :  *  A subclass of LogicError will be thrown if Xapian detects a violation
         145                 :  *  of a class invariant or a logical precondition or postcondition, etc.
         146                 :  */
         147                 : class XAPIAN_VISIBILITY_DEFAULT LogicError : public Error {
         148                 :   protected:
         149                 :     /** @private @internal
         150                 :      *  @brief Constructor for use by constructors of derived classes.
         151                 :      */
         152                 :     LogicError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         153                 :         : Error(msg_, context_, type_, error_string_) {}
         154                 :
         155                 :     /** @private @internal
         156                 :      *  @brief Constructor for use by constructors of derived classes.
         157                 :      */
         158                 :     LogicError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         159                 :         : Error(msg_, context_, type_, errno_) {}
         160                 : };
         161                 :
         162                 : /** The base class for exceptions indicating errors only detectable at runtime.
         163                 :  *
         164                 :  *  A subclass of RuntimeError will be thrown if Xapian detects an error
         165                 :  *  which is exception derived from RuntimeError is thrown when an
         166                 :  *  error is caused by problems with the data or environment rather
         167                 :  *  than a programming mistake.
         168                 :  */
         169                 : class XAPIAN_VISIBILITY_DEFAULT RuntimeError : public Error {
         170                 :   protected:
         171                 :     /** @private @internal
         172                 :      *  @brief Constructor for use by constructors of derived classes.
         173                 :      */
         174                 :     RuntimeError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         175                 :         : Error(msg_, context_, type_, error_string_) {}
         176                 :
         177                 :     /** @private @internal
         178                 :      *  @brief Constructor for use by constructors of derived classes.
         179                 :      */
         180                 :     RuntimeError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         181                 :         : Error(msg_, context_, type_, errno_) {}
         182                 : };
         183                 :
         184                 : /** AssertionError is thrown if a logical assertion inside Xapian fails.
         185                 :  *
         186                 :  *  In a debug build of Xapian, a failed assertion in the core library code
         187                 :  *  will cause AssertionError to be thrown.
         188                 :  *
         189                 :  *  This represents a bug in Xapian (either an invariant, precondition, etc
         190                 :  *  has been violated, or the assertion is incorrect!)
         191                 :  */
         192                 : class XAPIAN_VISIBILITY_DEFAULT AssertionError : public LogicError {
         193                 :   public:
         194                 :     /** @private @internal
         195                 :      *  @brief Private constructor for use by remote backend.
         196                 :      *
         197                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         198                 :      */
         199                 :     AssertionError(const std::string &msg_, const std::string &context_, const char * error_string_)
         200                 :         : LogicError(msg_, context_, "AssertionError", error_string_) {}
         201                 :     /** General purpose constructor which allows setting errno. */
         202                 :     explicit AssertionError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         203                 :         : LogicError(msg_, context_, "AssertionError", errno_) {}
         204                 :     /** Construct from message and errno value. */
         205                 :     AssertionError(const std::string &msg_, int errno_)
         206                 :         : LogicError(msg_, "", "AssertionError", errno_) {}
         207                 :   protected:
         208                 :     /** @private @internal
         209                 :      *  @brief Constructor for use by constructors of derived classes.
         210                 :      */
         211                 :     AssertionError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         212                 :         : LogicError(msg_, context_, type_, error_string_) {}
         213                 :
         214                 :     /** @private @internal
         215                 :      *  @brief Constructor for use by constructors of derived classes.
         216                 :      */
         217                 :     AssertionError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         218                 :         : LogicError(msg_, context_, type_, errno_) {}
         219                 : };
         220                 :
         221                 : /** InvalidArgumentError indicates an invalid parameter value was passed to the API.
         222                 : */
         223                 : class XAPIAN_VISIBILITY_DEFAULT InvalidArgumentError : public LogicError {
         224                 :   public:
         225                 :     /** @private @internal
         226                 :      *  @brief Private constructor for use by remote backend.
         227                 :      *
         228                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         229                 :      */
         230                 :     InvalidArgumentError(const std::string &msg_, const std::string &context_, const char * error_string_)
         231                 :         : LogicError(msg_, context_, "InvalidArgumentError", error_string_) {}
         232                 :     /** General purpose constructor which allows setting errno. */
         233                 :     explicit InvalidArgumentError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         234                 :         : LogicError(msg_, context_, "InvalidArgumentError", errno_) {}
         235                 :     /** Construct from message and errno value. */
         236                 :     InvalidArgumentError(const std::string &msg_, int errno_)
         237                 :         : LogicError(msg_, "", "InvalidArgumentError", errno_) {}
         238                 :   protected:
         239                 :     /** @private @internal
         240                 :      *  @brief Constructor for use by constructors of derived classes.
         241                 :      */
         242                 :     InvalidArgumentError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         243                 :         : LogicError(msg_, context_, type_, error_string_) {}
         244                 :
         245                 :     /** @private @internal
         246                 :      *  @brief Constructor for use by constructors of derived classes.
         247                 :      */
         248                 :     InvalidArgumentError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         249                 :         : LogicError(msg_, context_, type_, errno_) {}
         250                 : };
         251                 :
         252                 : /** InvalidOperationError indicates the API was used in an invalid way.
         253                 :  */
         254                 : class XAPIAN_VISIBILITY_DEFAULT InvalidOperationError : public LogicError {
         255                 :   public:
         256                 :     /** @private @internal
         257                 :      *  @brief Private constructor for use by remote backend.
         258                 :      *
         259                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         260                 :      */
         261                 :     InvalidOperationError(const std::string &msg_, const std::string &context_, const char * error_string_)
         262                 :         : LogicError(msg_, context_, "InvalidOperationError", error_string_) {}
         263                 :     /** General purpose constructor which allows setting errno. */
         264                 :     explicit InvalidOperationError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         265                 :         : LogicError(msg_, context_, "InvalidOperationError", errno_) {}
         266                 :     /** Construct from message and errno value. */
         267                 :     InvalidOperationError(const std::string &msg_, int errno_)
         268                 :         : LogicError(msg_, "", "InvalidOperationError", errno_) {}
         269                 :   protected:
         270                 :     /** @private @internal
         271                 :      *  @brief Constructor for use by constructors of derived classes.
         272                 :      */
         273                 :     InvalidOperationError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         274                 :         : LogicError(msg_, context_, type_, error_string_) {}
         275                 :
         276                 :     /** @private @internal
         277                 :      *  @brief Constructor for use by constructors of derived classes.
         278                 :      */
         279                 :     InvalidOperationError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         280                 :         : LogicError(msg_, context_, type_, errno_) {}
         281                 : };
         282                 :
         283                 : /** UnimplementedError indicates an attempt to use an unimplemented feature. */
         284                 : class XAPIAN_VISIBILITY_DEFAULT UnimplementedError : public LogicError {
         285                 :   public:
         286                 :     /** @private @internal
         287                 :      *  @brief Private constructor for use by remote backend.
         288                 :      *
         289                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         290                 :      */
         291                 :     UnimplementedError(const std::string &msg_, const std::string &context_, const char * error_string_)
         292                 :         : LogicError(msg_, context_, "UnimplementedError", error_string_) {}
         293                 :     /** General purpose constructor which allows setting errno. */
         294                 :     explicit UnimplementedError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         295                 :         : LogicError(msg_, context_, "UnimplementedError", errno_) {}
         296                 :     /** Construct from message and errno value. */
         297                 :     UnimplementedError(const std::string &msg_, int errno_)
         298                 :         : LogicError(msg_, "", "UnimplementedError", errno_) {}
         299                 :   protected:
         300                 :     /** @private @internal
         301                 :      *  @brief Constructor for use by constructors of derived classes.
         302                 :      */
         303                 :     UnimplementedError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         304                 :         : LogicError(msg_, context_, type_, error_string_) {}
         305                 :
         306                 :     /** @private @internal
         307                 :      *  @brief Constructor for use by constructors of derived classes.
         308                 :      */
         309                 :     UnimplementedError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         310                 :         : LogicError(msg_, context_, type_, errno_) {}
         311                 : };
         312                 :
         313                 : /** DatabaseError indicates some sort of database related error. */
         314                 : class XAPIAN_VISIBILITY_DEFAULT DatabaseError : public RuntimeError {
         315                 :   public:
         316                 :     /** @private @internal
         317                 :      *  @brief Private constructor for use by remote backend.
         318                 :      *
         319                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         320                 :      */
         321                 :     DatabaseError(const std::string &msg_, const std::string &context_, const char * error_string_)
         322                 :         : RuntimeError(msg_, context_, "DatabaseError", error_string_) {}
         323                 :     /** General purpose constructor which allows setting errno. */
         324                 :     explicit DatabaseError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         325                 :         : RuntimeError(msg_, context_, "DatabaseError", errno_) {}
         326                 :     /** Construct from message and errno value. */
         327                 :     DatabaseError(const std::string &msg_, int errno_)
         328                 :         : RuntimeError(msg_, "", "DatabaseError", errno_) {}
         329                 :   protected:
         330                 :     /** @private @internal
         331                 :      *  @brief Constructor for use by constructors of derived classes.
         332                 :      */
         333                 :     DatabaseError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         334                 :         : RuntimeError(msg_, context_, type_, error_string_) {}
         335                 :
         336                 :     /** @private @internal
         337                 :      *  @brief Constructor for use by constructors of derived classes.
         338                 :      */
         339                 :     DatabaseError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         340                 :         : RuntimeError(msg_, context_, type_, errno_) {}
         341                 : };
         342                 :
         343                 : /** DatabaseCorruptError indicates database corruption was detected. */
         344                 : class XAPIAN_VISIBILITY_DEFAULT DatabaseCorruptError : public DatabaseError {
         345                 :   public:
         346                 :     /** @private @internal
         347                 :      *  @brief Private constructor for use by remote backend.
         348                 :      *
         349                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         350                 :      */
         351                 :     DatabaseCorruptError(const std::string &msg_, const std::string &context_, const char * error_string_)
         352                 :         : DatabaseError(msg_, context_, "DatabaseCorruptError", error_string_) {}
         353                 :     /** General purpose constructor which allows setting errno. */
         354                 :     explicit DatabaseCorruptError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         355                 :         : DatabaseError(msg_, context_, "DatabaseCorruptError", errno_) {}
         356                 :     /** Construct from message and errno value. */
         357                 :     DatabaseCorruptError(const std::string &msg_, int errno_)
         358                 :         : DatabaseError(msg_, "", "DatabaseCorruptError", errno_) {}
         359                 :   protected:
         360                 :     /** @private @internal
         361                 :      *  @brief Constructor for use by constructors of derived classes.
         362                 :      */
         363                 :     DatabaseCorruptError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         364                 :         : DatabaseError(msg_, context_, type_, error_string_) {}
         365                 :
         366                 :     /** @private @internal
         367                 :      *  @brief Constructor for use by constructors of derived classes.
         368                 :      */
         369                 :     DatabaseCorruptError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         370                 :         : DatabaseError(msg_, context_, type_, errno_) {}
         371                 : };
         372                 :
         373                 : /** DatabaseCreateError indicates a failure to create a database. */
         374                 : class XAPIAN_VISIBILITY_DEFAULT DatabaseCreateError : public DatabaseError {
         375                 :   public:
         376                 :     /** @private @internal
         377                 :      *  @brief Private constructor for use by remote backend.
         378                 :      *
         379                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         380                 :      */
         381                 :     DatabaseCreateError(const std::string &msg_, const std::string &context_, const char * error_string_)
         382                 :         : DatabaseError(msg_, context_, "DatabaseCreateError", error_string_) {}
         383                 :     /** General purpose constructor which allows setting errno. */
         384                 :     explicit DatabaseCreateError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         385                 :         : DatabaseError(msg_, context_, "DatabaseCreateError", errno_) {}
         386                 :     /** Construct from message and errno value. */
         387                 :     DatabaseCreateError(const std::string &msg_, int errno_)
         388                 :         : DatabaseError(msg_, "", "DatabaseCreateError", errno_) {}
         389                 :   protected:
         390                 :     /** @private @internal
         391                 :      *  @brief Constructor for use by constructors of derived classes.
         392                 :      */
         393                 :     DatabaseCreateError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         394                 :         : DatabaseError(msg_, context_, type_, error_string_) {}
         395                 :
         396                 :     /** @private @internal
         397                 :      *  @brief Constructor for use by constructors of derived classes.
         398                 :      */
         399                 :     DatabaseCreateError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         400                 :         : DatabaseError(msg_, context_, type_, errno_) {}
         401                 : };
         402                 :
         403                 : /** DatabaseLockError indicates failure to lock a database. */
         404                 : class XAPIAN_VISIBILITY_DEFAULT DatabaseLockError : public DatabaseError {
         405                 :   public:
         406                 :     /** @private @internal
         407                 :      *  @brief Private constructor for use by remote backend.
         408                 :      *
         409                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         410                 :      */
         411                 :     DatabaseLockError(const std::string &msg_, const std::string &context_, const char * error_string_)
         412                 :         : DatabaseError(msg_, context_, "DatabaseLockError", error_string_) {}
         413                 :     /** General purpose constructor which allows setting errno. */
         414                 :     explicit DatabaseLockError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         415                 :         : DatabaseError(msg_, context_, "DatabaseLockError", errno_) {}
         416                 :     /** Construct from message and errno value. */
         417                 :     DatabaseLockError(const std::string &msg_, int errno_)
         418                 :         : DatabaseError(msg_, "", "DatabaseLockError", errno_) {}
         419                 :   protected:
         420                 :     /** @private @internal
         421                 :      *  @brief Constructor for use by constructors of derived classes.
         422                 :      */
         423                 :     DatabaseLockError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         424                 :         : DatabaseError(msg_, context_, type_, error_string_) {}
         425                 :
         426                 :     /** @private @internal
         427                 :      *  @brief Constructor for use by constructors of derived classes.
         428                 :      */
         429                 :     DatabaseLockError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         430                 :         : DatabaseError(msg_, context_, type_, errno_) {}
         431                 : };
         432                 :
         433                 : /** DatabaseModifiedError indicates a database was modified.
         434                 :  *
         435                 :  *  To recover after catching this error, you need to call
         436                 :  *  Xapian::Database::reopen() on the Database and repeat the operation
         437                 :  *  which failed.
         438                 :  */
         439                 : class XAPIAN_VISIBILITY_DEFAULT DatabaseModifiedError : public DatabaseError {
         440                 :   public:
         441                 :     /** @private @internal
         442                 :      *  @brief Private constructor for use by remote backend.
         443                 :      *
         444                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         445                 :      */
         446                 :     DatabaseModifiedError(const std::string &msg_, const std::string &context_, const char * error_string_)
         447                 :         : DatabaseError(msg_, context_, "DatabaseModifiedError", error_string_) {}
         448                 :     /** General purpose constructor which allows setting errno. */
         449                 :     explicit DatabaseModifiedError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         450                 :         : DatabaseError(msg_, context_, "DatabaseModifiedError", errno_) {}
         451                 :     /** Construct from message and errno value. */
         452                 :     DatabaseModifiedError(const std::string &msg_, int errno_)
         453                 :         : DatabaseError(msg_, "", "DatabaseModifiedError", errno_) {}
         454                 :   protected:
         455                 :     /** @private @internal
         456                 :      *  @brief Constructor for use by constructors of derived classes.
         457                 :      */
         458                 :     DatabaseModifiedError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         459                 :         : DatabaseError(msg_, context_, type_, error_string_) {}
         460                 :
         461                 :     /** @private @internal
         462                 :      *  @brief Constructor for use by constructors of derived classes.
         463                 :      */
         464                 :     DatabaseModifiedError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         465                 :         : DatabaseError(msg_, context_, type_, errno_) {}
         466                 : };
         467                 :
         468                 : /** DatabaseOpeningError indicates failure to open a database. */
         469                 : class XAPIAN_VISIBILITY_DEFAULT DatabaseOpeningError : public DatabaseError {
         470                 :   public:
         471                 :     /** @private @internal
         472                 :      *  @brief Private constructor for use by remote backend.
         473                 :      *
         474                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         475                 :      */
         476                 :     DatabaseOpeningError(const std::string &msg_, const std::string &context_, const char * error_string_)
         477                 :         : DatabaseError(msg_, context_, "DatabaseOpeningError", error_string_) {}
         478                 :     /** General purpose constructor which allows setting errno. */
         479                 :     explicit DatabaseOpeningError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         480                 :         : DatabaseError(msg_, context_, "DatabaseOpeningError", errno_) {}
         481                 :     /** Construct from message and errno value. */
         482                 :     DatabaseOpeningError(const std::string &msg_, int errno_)
         483                 :         : DatabaseError(msg_, "", "DatabaseOpeningError", errno_) {}
         484                 :   protected:
         485                 :     /** @private @internal
         486                 :      *  @brief Constructor for use by constructors of derived classes.
         487                 :      */
         488                 :     DatabaseOpeningError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         489                 :         : DatabaseError(msg_, context_, type_, error_string_) {}
         490                 :
         491                 :     /** @private @internal
         492                 :      *  @brief Constructor for use by constructors of derived classes.
         493                 :      */
         494                 :     DatabaseOpeningError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         495                 :         : DatabaseError(msg_, context_, type_, errno_) {}
         496                 : };
         497                 :
         498                 : /** DatabaseVersionError indicates that a database is in an unsupported format.
         499                 :  *
         500                 :  *  From time to time, new versions of Xapian will require the database format
         501                 :  *  to be changed, to allow new information to be stored or new optimisations
         502                 :  *  to be performed.  Backwards compatibility will sometimes be maintained, so
         503                 :  *  that new versions of Xapian can open old databases, but in some cases
         504                 :  *  Xapian will be unable to open a database because it is in too old (or new)
         505                 :  *  a format.  This can be resolved either be upgrading or downgrading the
         506                 :  *  version of Xapian in use, or by rebuilding the database from scratch with
         507                 :  *  the current version of Xapian.
         508                 :  */
         509                 : class XAPIAN_VISIBILITY_DEFAULT DatabaseVersionError : public DatabaseOpeningError {
         510                 :   public:
         511                 :     /** @private @internal
         512                 :      *  @brief Private constructor for use by remote backend.
         513                 :      *
         514                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         515                 :      */
         516                 :     DatabaseVersionError(const std::string &msg_, const std::string &context_, const char * error_string_)
         517                 :         : DatabaseOpeningError(msg_, context_, "DatabaseVersionError", error_string_) {}
         518                 :     /** General purpose constructor which allows setting errno. */
         519                 :     explicit DatabaseVersionError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         520                 :         : DatabaseOpeningError(msg_, context_, "DatabaseVersionError", errno_) {}
         521                 :     /** Construct from message and errno value. */
         522                 :     DatabaseVersionError(const std::string &msg_, int errno_)
         523                 :         : DatabaseOpeningError(msg_, "", "DatabaseVersionError", errno_) {}
         524                 :   protected:
         525                 :     /** @private @internal
         526                 :      *  @brief Constructor for use by constructors of derived classes.
         527                 :      */
         528                 :     DatabaseVersionError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         529                 :         : DatabaseOpeningError(msg_, context_, type_, error_string_) {}
         530                 :
         531                 :     /** @private @internal
         532                 :      *  @brief Constructor for use by constructors of derived classes.
         533                 :      */
         534                 :     DatabaseVersionError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         535                 :         : DatabaseOpeningError(msg_, context_, type_, errno_) {}
         536                 : };
         537                 :
         538                 : /** Indicates an attempt to access a document not present in the database. */
         539                 : class XAPIAN_VISIBILITY_DEFAULT DocNotFoundError : public RuntimeError {
         540                 :   public:
         541                 :     /** @private @internal
         542                 :      *  @brief Private constructor for use by remote backend.
         543                 :      *
         544                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         545                 :      */
         546                 :     DocNotFoundError(const std::string &msg_, const std::string &context_, const char * error_string_)
         547                 :         : RuntimeError(msg_, context_, "DocNotFoundError", error_string_) {}
         548                 :     /** General purpose constructor which allows setting errno. */
         549                 :     explicit DocNotFoundError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         550                 :         : RuntimeError(msg_, context_, "DocNotFoundError", errno_) {}
         551                 :     /** Construct from message and errno value. */
         552                 :     DocNotFoundError(const std::string &msg_, int errno_)
         553                 :         : RuntimeError(msg_, "", "DocNotFoundError", errno_) {}
         554                 :   protected:
         555                 :     /** @private @internal
         556                 :      *  @brief Constructor for use by constructors of derived classes.
         557                 :      */
         558                 :     DocNotFoundError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         559                 :         : RuntimeError(msg_, context_, type_, error_string_) {}
         560                 :
         561                 :     /** @private @internal
         562                 :      *  @brief Constructor for use by constructors of derived classes.
         563                 :      */
         564                 :     DocNotFoundError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         565                 :         : RuntimeError(msg_, context_, type_, errno_) {}
         566                 : };
         567                 :
         568                 : /** Indicates an attempt to use a feature which is unavailable.
         569                 :  *
         570                 :  *  Typically a feature is unavailable because it wasn't compiled in, or
         571                 :  *  because it requires other software or facilities which aren't available.
         572                 :  */
         573                 : class XAPIAN_VISIBILITY_DEFAULT FeatureUnavailableError : public RuntimeError {
         574                 :   public:
         575                 :     /** @private @internal
         576                 :      *  @brief Private constructor for use by remote backend.
         577                 :      *
         578                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         579                 :      */
         580                 :     FeatureUnavailableError(const std::string &msg_, const std::string &context_, const char * error_string_)
         581                 :         : RuntimeError(msg_, context_, "FeatureUnavailableError", error_string_) {}
         582                 :     /** General purpose constructor which allows setting errno. */
         583                 :     explicit FeatureUnavailableError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         584                 :         : RuntimeError(msg_, context_, "FeatureUnavailableError", errno_) {}
         585                 :     /** Construct from message and errno value. */
         586                 :     FeatureUnavailableError(const std::string &msg_, int errno_)
         587                 :         : RuntimeError(msg_, "", "FeatureUnavailableError", errno_) {}
         588                 :   protected:
         589                 :     /** @private @internal
         590                 :      *  @brief Constructor for use by constructors of derived classes.
         591                 :      */
         592                 :     FeatureUnavailableError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         593                 :         : RuntimeError(msg_, context_, type_, error_string_) {}
         594                 :
         595                 :     /** @private @internal
         596                 :      *  @brief Constructor for use by constructors of derived classes.
         597                 :      */
         598                 :     FeatureUnavailableError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         599                 :         : RuntimeError(msg_, context_, type_, errno_) {}
         600                 : };
         601                 :
         602                 : /** InternalError indicates a runtime problem of some sort. */
         603                 : class XAPIAN_VISIBILITY_DEFAULT InternalError : public RuntimeError {
         604                 :   public:
         605                 :     /** @private @internal
         606                 :      *  @brief Private constructor for use by remote backend.
         607                 :      *
         608                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         609                 :      */
         610                 :     InternalError(const std::string &msg_, const std::string &context_, const char * error_string_)
         611                 :         : RuntimeError(msg_, context_, "InternalError", error_string_) {}
         612                 :     /** General purpose constructor which allows setting errno. */
         613                 :     explicit InternalError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         614                 :         : RuntimeError(msg_, context_, "InternalError", errno_) {}
         615                 :     /** Construct from message and errno value. */
         616                 :     InternalError(const std::string &msg_, int errno_)
         617                 :         : RuntimeError(msg_, "", "InternalError", errno_) {}
         618                 :   protected:
         619                 :     /** @private @internal
         620                 :      *  @brief Constructor for use by constructors of derived classes.
         621                 :      */
         622                 :     InternalError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         623                 :         : RuntimeError(msg_, context_, type_, error_string_) {}
         624                 :
         625                 :     /** @private @internal
         626                 :      *  @brief Constructor for use by constructors of derived classes.
         627                 :      */
         628                 :     InternalError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         629                 :         : RuntimeError(msg_, context_, type_, errno_) {}
         630                 : };
         631                 :
         632                 : /** Indicates a problem communicating with a remote database. */
         633                 : class XAPIAN_VISIBILITY_DEFAULT NetworkError : public RuntimeError {
         634                 :   public:
         635                 :     /** @private @internal
         636                 :      *  @brief Private constructor for use by remote backend.
         637                 :      *
         638                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         639                 :      */
         640                 :     NetworkError(const std::string &msg_, const std::string &context_, const char * error_string_)
         641                 :         : RuntimeError(msg_, context_, "NetworkError", error_string_) {}
         642                 :     /** General purpose constructor which allows setting errno. */
         643                 :     explicit NetworkError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         644                 :         : RuntimeError(msg_, context_, "NetworkError", errno_) {}
         645                 :     /** Construct from message and errno value. */
         646                 :     NetworkError(const std::string &msg_, int errno_)
         647                 :         : RuntimeError(msg_, "", "NetworkError", errno_) {}
         648                 :   protected:
         649                 :     /** @private @internal
         650                 :      *  @brief Constructor for use by constructors of derived classes.
         651                 :      */
         652                 :     NetworkError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         653                 :         : RuntimeError(msg_, context_, type_, error_string_) {}
         654                 :
         655                 :     /** @private @internal
         656                 :      *  @brief Constructor for use by constructors of derived classes.
         657                 :      */
         658                 :     NetworkError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         659                 :         : RuntimeError(msg_, context_, type_, errno_) {}
         660                 : };
         661                 :
         662                 : /** Indicates a timeout expired while communicating with a remote database. */
         663                 : class XAPIAN_VISIBILITY_DEFAULT NetworkTimeoutError : public NetworkError {
         664                 :   public:
         665                 :     /** @private @internal
         666                 :      *  @brief Private constructor for use by remote backend.
         667                 :      *
         668                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         669                 :      */
         670                 :     NetworkTimeoutError(const std::string &msg_, const std::string &context_, const char * error_string_)
         671                 :         : NetworkError(msg_, context_, "NetworkTimeoutError", error_string_) {}
         672                 :     /** General purpose constructor which allows setting errno. */
         673                 :     explicit NetworkTimeoutError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         674                 :         : NetworkError(msg_, context_, "NetworkTimeoutError", errno_) {}
         675                 :     /** Construct from message and errno value. */
         676                 :     NetworkTimeoutError(const std::string &msg_, int errno_)
         677                 :         : NetworkError(msg_, "", "NetworkTimeoutError", errno_) {}
         678                 :   protected:
         679                 :     /** @private @internal
         680                 :      *  @brief Constructor for use by constructors of derived classes.
         681                 :      */
         682                 :     NetworkTimeoutError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         683                 :         : NetworkError(msg_, context_, type_, error_string_) {}
         684                 :
         685                 :     /** @private @internal
         686                 :      *  @brief Constructor for use by constructors of derived classes.
         687                 :      */
         688                 :     NetworkTimeoutError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         689                 :         : NetworkError(msg_, context_, type_, errno_) {}
         690                 : };
         691                 :
         692                 : /** Indicates a query string can't be parsed. */
         693                 : class XAPIAN_VISIBILITY_DEFAULT QueryParserError : public RuntimeError {
         694                 :   public:
         695                 :     /** @private @internal
         696                 :      *  @brief Private constructor for use by remote backend.
         697                 :      *
         698                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         699                 :      */
         700                 :     QueryParserError(const std::string &msg_, const std::string &context_, const char * error_string_)
         701                 :         : RuntimeError(msg_, context_, "QueryParserError", error_string_) {}
         702                 :     /** General purpose constructor which allows setting errno. */
         703                 :     explicit QueryParserError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         704                 :         : RuntimeError(msg_, context_, "QueryParserError", errno_) {}
         705                 :     /** Construct from message and errno value. */
         706                 :     QueryParserError(const std::string &msg_, int errno_)
         707                 :         : RuntimeError(msg_, "", "QueryParserError", errno_) {}
         708                 :   protected:
         709                 :     /** @private @internal
         710                 :      *  @brief Constructor for use by constructors of derived classes.
         711                 :      */
         712                 :     QueryParserError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         713                 :         : RuntimeError(msg_, context_, type_, error_string_) {}
         714                 :
         715                 :     /** @private @internal
         716                 :      *  @brief Constructor for use by constructors of derived classes.
         717                 :      */
         718                 :     QueryParserError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         719                 :         : RuntimeError(msg_, context_, type_, errno_) {}
         720                 : };
         721                 :
         722                 : /** RangeError indicates an attempt to access outside the bounds of a container.
         723                 :  */
         724                 : class XAPIAN_VISIBILITY_DEFAULT RangeError : public RuntimeError {
         725                 :   public:
         726                 :     /** @private @internal
         727                 :      *  @brief Private constructor for use by remote backend.
         728                 :      *
         729                 :      *  @param error_string_    Optional string describing error.  May be NULL.
         730                 :      */
         731                 :     RangeError(const std::string &msg_, const std::string &context_, const char * error_string_)
         732                 :         : RuntimeError(msg_, context_, "RangeError", error_string_) {}
         733                 :     /** General purpose constructor which allows setting errno. */
         734                 :     explicit RangeError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
         735                 :         : RuntimeError(msg_, context_, "RangeError", errno_) {}
         736                 :     /** Construct from message and errno value. */
         737                 :     RangeError(const std::string &msg_, int errno_)
         738                 :         : RuntimeError(msg_, "", "RangeError", errno_) {}
         739                 :   protected:
         740                 :     /** @private @internal
         741                 :      *  @brief Constructor for use by constructors of derived classes.
         742                 :      */
         743                 :     RangeError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
         744                 :         : RuntimeError(msg_, context_, type_, error_string_) {}
         745                 :
         746                 :     /** @private @internal
         747                 :      *  @brief Constructor for use by constructors of derived classes.
         748                 :      */
         749                 :     RangeError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
         750                 :         : RuntimeError(msg_, context_, type_, errno_) {}
         751                 : };
         752                 :
         753                 : }
         754                 :
         755                 : #endif /* XAPIAN_INCLUDED_ERROR_H */

Generated by: LTP GCOV extension version 1.6