include/xapian/error.h

Go to the documentation of this file.
00001 
00004 /* Warning: This file is generated by ./generate-exceptions - do not modify directly! */
00005 /* Copyright (C) 2003,2004,2006,2007 Olly Betts
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License as
00009  * published by the Free Software Foundation; either version 2 of the
00010  * License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00020  */
00021 
00022 #ifndef XAPIAN_INCLUDED_ERROR_H
00023 #define XAPIAN_INCLUDED_ERROR_H
00024 
00025 #include <string>
00026 #include <xapian/deprecated.h>
00027 #include <xapian/visibility.h>
00028 
00029 namespace Xapian {
00030 
00031 class ErrorHandler;
00032 
00038 class XAPIAN_VISIBILITY_DEFAULT Error {
00039     // ErrorHandler needs to be able to access Error::already_handled.
00040     friend class ErrorHandler;
00041 
00043     std::string msg;
00044 
00052     std::string context;
00053 
00055     const char * type;
00056 
00070     int my_errno;
00071 
00076     mutable std::string error_string;
00077 
00079     bool already_handled;
00080 
00082     void operator=(const Error &o);
00083 
00084   protected:
00088     Error(const std::string &msg_, const std::string &context_,
00089           const char * type_, const char * error_string_);
00090 
00094     Error(const std::string &msg_, const std::string &context_,
00095           const char * type_, int errno_)
00096         : msg(msg_), context(context_), type(type_), my_errno(errno_),
00097           error_string(), already_handled(false) { }
00098 
00099   public:
00101     const char * get_type() const { return type; }
00102 
00104     const std::string & get_msg() const { return msg; }
00105 
00113     const std::string & get_context() const { return context; }
00114 
00121     const char * get_error_string() const;
00122 
00134     XAPIAN_DEPRECATED(int get_errno() const);
00135 
00137     std::string get_description() const;
00138 };
00139 
00140 inline int Xapian::Error::get_errno() const { return my_errno; }
00141 
00147 class XAPIAN_VISIBILITY_DEFAULT LogicError : public Error {
00148   protected:
00152     LogicError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00153         : Error(msg_, context_, type_, error_string_) {}
00154 
00158     LogicError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00159         : Error(msg_, context_, type_, errno_) {}
00160 };
00161 
00169 class XAPIAN_VISIBILITY_DEFAULT RuntimeError : public Error {
00170   protected:
00174     RuntimeError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00175         : Error(msg_, context_, type_, error_string_) {}
00176 
00180     RuntimeError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00181         : Error(msg_, context_, type_, errno_) {}
00182 };
00183 
00192 class XAPIAN_VISIBILITY_DEFAULT AssertionError : public LogicError {
00193   public:
00199     AssertionError(const std::string &msg_, const std::string &context_, const char * error_string_)
00200         : LogicError(msg_, context_, "AssertionError", error_string_) {}
00202     explicit AssertionError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00203         : LogicError(msg_, context_, "AssertionError", errno_) {}
00205     AssertionError(const std::string &msg_, int errno_)
00206         : LogicError(msg_, "", "AssertionError", errno_) {}
00207   protected:
00211     AssertionError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00212         : LogicError(msg_, context_, type_, error_string_) {}
00213 
00217     AssertionError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00218         : LogicError(msg_, context_, type_, errno_) {}
00219 };
00220 
00223 class XAPIAN_VISIBILITY_DEFAULT InvalidArgumentError : public LogicError {
00224   public:
00230     InvalidArgumentError(const std::string &msg_, const std::string &context_, const char * error_string_)
00231         : LogicError(msg_, context_, "InvalidArgumentError", error_string_) {}
00233     explicit InvalidArgumentError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00234         : LogicError(msg_, context_, "InvalidArgumentError", errno_) {}
00236     InvalidArgumentError(const std::string &msg_, int errno_)
00237         : LogicError(msg_, "", "InvalidArgumentError", errno_) {}
00238   protected:
00242     InvalidArgumentError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00243         : LogicError(msg_, context_, type_, error_string_) {}
00244 
00248     InvalidArgumentError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00249         : LogicError(msg_, context_, type_, errno_) {}
00250 };
00251 
00254 class XAPIAN_VISIBILITY_DEFAULT InvalidOperationError : public LogicError {
00255   public:
00261     InvalidOperationError(const std::string &msg_, const std::string &context_, const char * error_string_)
00262         : LogicError(msg_, context_, "InvalidOperationError", error_string_) {}
00264     explicit InvalidOperationError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00265         : LogicError(msg_, context_, "InvalidOperationError", errno_) {}
00267     InvalidOperationError(const std::string &msg_, int errno_)
00268         : LogicError(msg_, "", "InvalidOperationError", errno_) {}
00269   protected:
00273     InvalidOperationError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00274         : LogicError(msg_, context_, type_, error_string_) {}
00275 
00279     InvalidOperationError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00280         : LogicError(msg_, context_, type_, errno_) {}
00281 };
00282 
00284 class XAPIAN_VISIBILITY_DEFAULT UnimplementedError : public LogicError {
00285   public:
00291     UnimplementedError(const std::string &msg_, const std::string &context_, const char * error_string_)
00292         : LogicError(msg_, context_, "UnimplementedError", error_string_) {}
00294     explicit UnimplementedError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00295         : LogicError(msg_, context_, "UnimplementedError", errno_) {}
00297     UnimplementedError(const std::string &msg_, int errno_)
00298         : LogicError(msg_, "", "UnimplementedError", errno_) {}
00299   protected:
00303     UnimplementedError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00304         : LogicError(msg_, context_, type_, error_string_) {}
00305 
00309     UnimplementedError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00310         : LogicError(msg_, context_, type_, errno_) {}
00311 };
00312 
00314 class XAPIAN_VISIBILITY_DEFAULT DatabaseError : public RuntimeError {
00315   public:
00321     DatabaseError(const std::string &msg_, const std::string &context_, const char * error_string_)
00322         : RuntimeError(msg_, context_, "DatabaseError", error_string_) {}
00324     explicit DatabaseError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00325         : RuntimeError(msg_, context_, "DatabaseError", errno_) {}
00327     DatabaseError(const std::string &msg_, int errno_)
00328         : RuntimeError(msg_, "", "DatabaseError", errno_) {}
00329   protected:
00333     DatabaseError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00334         : RuntimeError(msg_, context_, type_, error_string_) {}
00335 
00339     DatabaseError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00340         : RuntimeError(msg_, context_, type_, errno_) {}
00341 };
00342 
00344 class XAPIAN_VISIBILITY_DEFAULT DatabaseCorruptError : public DatabaseError {
00345   public:
00351     DatabaseCorruptError(const std::string &msg_, const std::string &context_, const char * error_string_)
00352         : DatabaseError(msg_, context_, "DatabaseCorruptError", error_string_) {}
00354     explicit DatabaseCorruptError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00355         : DatabaseError(msg_, context_, "DatabaseCorruptError", errno_) {}
00357     DatabaseCorruptError(const std::string &msg_, int errno_)
00358         : DatabaseError(msg_, "", "DatabaseCorruptError", errno_) {}
00359   protected:
00363     DatabaseCorruptError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00364         : DatabaseError(msg_, context_, type_, error_string_) {}
00365 
00369     DatabaseCorruptError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00370         : DatabaseError(msg_, context_, type_, errno_) {}
00371 };
00372 
00374 class XAPIAN_VISIBILITY_DEFAULT DatabaseCreateError : public DatabaseError {
00375   public:
00381     DatabaseCreateError(const std::string &msg_, const std::string &context_, const char * error_string_)
00382         : DatabaseError(msg_, context_, "DatabaseCreateError", error_string_) {}
00384     explicit DatabaseCreateError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00385         : DatabaseError(msg_, context_, "DatabaseCreateError", errno_) {}
00387     DatabaseCreateError(const std::string &msg_, int errno_)
00388         : DatabaseError(msg_, "", "DatabaseCreateError", errno_) {}
00389   protected:
00393     DatabaseCreateError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00394         : DatabaseError(msg_, context_, type_, error_string_) {}
00395 
00399     DatabaseCreateError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00400         : DatabaseError(msg_, context_, type_, errno_) {}
00401 };
00402 
00404 class XAPIAN_VISIBILITY_DEFAULT DatabaseLockError : public DatabaseError {
00405   public:
00411     DatabaseLockError(const std::string &msg_, const std::string &context_, const char * error_string_)
00412         : DatabaseError(msg_, context_, "DatabaseLockError", error_string_) {}
00414     explicit DatabaseLockError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00415         : DatabaseError(msg_, context_, "DatabaseLockError", errno_) {}
00417     DatabaseLockError(const std::string &msg_, int errno_)
00418         : DatabaseError(msg_, "", "DatabaseLockError", errno_) {}
00419   protected:
00423     DatabaseLockError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00424         : DatabaseError(msg_, context_, type_, error_string_) {}
00425 
00429     DatabaseLockError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00430         : DatabaseError(msg_, context_, type_, errno_) {}
00431 };
00432 
00439 class XAPIAN_VISIBILITY_DEFAULT DatabaseModifiedError : public DatabaseError {
00440   public:
00446     DatabaseModifiedError(const std::string &msg_, const std::string &context_, const char * error_string_)
00447         : DatabaseError(msg_, context_, "DatabaseModifiedError", error_string_) {}
00449     explicit DatabaseModifiedError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00450         : DatabaseError(msg_, context_, "DatabaseModifiedError", errno_) {}
00452     DatabaseModifiedError(const std::string &msg_, int errno_)
00453         : DatabaseError(msg_, "", "DatabaseModifiedError", errno_) {}
00454   protected:
00458     DatabaseModifiedError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00459         : DatabaseError(msg_, context_, type_, error_string_) {}
00460 
00464     DatabaseModifiedError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00465         : DatabaseError(msg_, context_, type_, errno_) {}
00466 };
00467 
00469 class XAPIAN_VISIBILITY_DEFAULT DatabaseOpeningError : public DatabaseError {
00470   public:
00476     DatabaseOpeningError(const std::string &msg_, const std::string &context_, const char * error_string_)
00477         : DatabaseError(msg_, context_, "DatabaseOpeningError", error_string_) {}
00479     explicit DatabaseOpeningError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00480         : DatabaseError(msg_, context_, "DatabaseOpeningError", errno_) {}
00482     DatabaseOpeningError(const std::string &msg_, int errno_)
00483         : DatabaseError(msg_, "", "DatabaseOpeningError", errno_) {}
00484   protected:
00488     DatabaseOpeningError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00489         : DatabaseError(msg_, context_, type_, error_string_) {}
00490 
00494     DatabaseOpeningError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00495         : DatabaseError(msg_, context_, type_, errno_) {}
00496 };
00497 
00509 class XAPIAN_VISIBILITY_DEFAULT DatabaseVersionError : public DatabaseOpeningError {
00510   public:
00516     DatabaseVersionError(const std::string &msg_, const std::string &context_, const char * error_string_)
00517         : DatabaseOpeningError(msg_, context_, "DatabaseVersionError", error_string_) {}
00519     explicit DatabaseVersionError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00520         : DatabaseOpeningError(msg_, context_, "DatabaseVersionError", errno_) {}
00522     DatabaseVersionError(const std::string &msg_, int errno_)
00523         : DatabaseOpeningError(msg_, "", "DatabaseVersionError", errno_) {}
00524   protected:
00528     DatabaseVersionError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00529         : DatabaseOpeningError(msg_, context_, type_, error_string_) {}
00530 
00534     DatabaseVersionError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00535         : DatabaseOpeningError(msg_, context_, type_, errno_) {}
00536 };
00537 
00539 class XAPIAN_VISIBILITY_DEFAULT DocNotFoundError : public RuntimeError {
00540   public:
00546     DocNotFoundError(const std::string &msg_, const std::string &context_, const char * error_string_)
00547         : RuntimeError(msg_, context_, "DocNotFoundError", error_string_) {}
00549     explicit DocNotFoundError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00550         : RuntimeError(msg_, context_, "DocNotFoundError", errno_) {}
00552     DocNotFoundError(const std::string &msg_, int errno_)
00553         : RuntimeError(msg_, "", "DocNotFoundError", errno_) {}
00554   protected:
00558     DocNotFoundError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00559         : RuntimeError(msg_, context_, type_, error_string_) {}
00560 
00564     DocNotFoundError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00565         : RuntimeError(msg_, context_, type_, errno_) {}
00566 };
00567 
00573 class XAPIAN_VISIBILITY_DEFAULT FeatureUnavailableError : public RuntimeError {
00574   public:
00580     FeatureUnavailableError(const std::string &msg_, const std::string &context_, const char * error_string_)
00581         : RuntimeError(msg_, context_, "FeatureUnavailableError", error_string_) {}
00583     explicit FeatureUnavailableError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00584         : RuntimeError(msg_, context_, "FeatureUnavailableError", errno_) {}
00586     FeatureUnavailableError(const std::string &msg_, int errno_)
00587         : RuntimeError(msg_, "", "FeatureUnavailableError", errno_) {}
00588   protected:
00592     FeatureUnavailableError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00593         : RuntimeError(msg_, context_, type_, error_string_) {}
00594 
00598     FeatureUnavailableError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00599         : RuntimeError(msg_, context_, type_, errno_) {}
00600 };
00601 
00603 class XAPIAN_VISIBILITY_DEFAULT InternalError : public RuntimeError {
00604   public:
00610     InternalError(const std::string &msg_, const std::string &context_, const char * error_string_)
00611         : RuntimeError(msg_, context_, "InternalError", error_string_) {}
00613     explicit InternalError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00614         : RuntimeError(msg_, context_, "InternalError", errno_) {}
00616     InternalError(const std::string &msg_, int errno_)
00617         : RuntimeError(msg_, "", "InternalError", errno_) {}
00618   protected:
00622     InternalError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00623         : RuntimeError(msg_, context_, type_, error_string_) {}
00624 
00628     InternalError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00629         : RuntimeError(msg_, context_, type_, errno_) {}
00630 };
00631 
00633 class XAPIAN_VISIBILITY_DEFAULT NetworkError : public RuntimeError {
00634   public:
00640     NetworkError(const std::string &msg_, const std::string &context_, const char * error_string_)
00641         : RuntimeError(msg_, context_, "NetworkError", error_string_) {}
00643     explicit NetworkError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00644         : RuntimeError(msg_, context_, "NetworkError", errno_) {}
00646     NetworkError(const std::string &msg_, int errno_)
00647         : RuntimeError(msg_, "", "NetworkError", errno_) {}
00648   protected:
00652     NetworkError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00653         : RuntimeError(msg_, context_, type_, error_string_) {}
00654 
00658     NetworkError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00659         : RuntimeError(msg_, context_, type_, errno_) {}
00660 };
00661 
00663 class XAPIAN_VISIBILITY_DEFAULT NetworkTimeoutError : public NetworkError {
00664   public:
00670     NetworkTimeoutError(const std::string &msg_, const std::string &context_, const char * error_string_)
00671         : NetworkError(msg_, context_, "NetworkTimeoutError", error_string_) {}
00673     explicit NetworkTimeoutError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00674         : NetworkError(msg_, context_, "NetworkTimeoutError", errno_) {}
00676     NetworkTimeoutError(const std::string &msg_, int errno_)
00677         : NetworkError(msg_, "", "NetworkTimeoutError", errno_) {}
00678   protected:
00682     NetworkTimeoutError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00683         : NetworkError(msg_, context_, type_, error_string_) {}
00684 
00688     NetworkTimeoutError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00689         : NetworkError(msg_, context_, type_, errno_) {}
00690 };
00691 
00693 class XAPIAN_VISIBILITY_DEFAULT QueryParserError : public RuntimeError {
00694   public:
00700     QueryParserError(const std::string &msg_, const std::string &context_, const char * error_string_)
00701         : RuntimeError(msg_, context_, "QueryParserError", error_string_) {}
00703     explicit QueryParserError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00704         : RuntimeError(msg_, context_, "QueryParserError", errno_) {}
00706     QueryParserError(const std::string &msg_, int errno_)
00707         : RuntimeError(msg_, "", "QueryParserError", errno_) {}
00708   protected:
00712     QueryParserError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00713         : RuntimeError(msg_, context_, type_, error_string_) {}
00714 
00718     QueryParserError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00719         : RuntimeError(msg_, context_, type_, errno_) {}
00720 };
00721 
00724 class XAPIAN_VISIBILITY_DEFAULT RangeError : public RuntimeError {
00725   public:
00731     RangeError(const std::string &msg_, const std::string &context_, const char * error_string_)
00732         : RuntimeError(msg_, context_, "RangeError", error_string_) {}
00734     explicit RangeError(const std::string &msg_, const std::string &context_ = "", int errno_ = 0)
00735         : RuntimeError(msg_, context_, "RangeError", errno_) {}
00737     RangeError(const std::string &msg_, int errno_)
00738         : RuntimeError(msg_, "", "RangeError", errno_) {}
00739   protected:
00743     RangeError(const std::string &msg_, const std::string &context_, const char * type_, const char * error_string_)
00744         : RuntimeError(msg_, context_, type_, error_string_) {}
00745 
00749     RangeError(const std::string &msg_, const std::string &context_, const char * type_, int errno_)
00750         : RuntimeError(msg_, context_, type_, errno_) {}
00751 };
00752 
00753 }
00754 
00755 #endif /* XAPIAN_INCLUDED_ERROR_H */

Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.