diff options
Diffstat (limited to 'libdbpp/error.h')
-rw-r--r-- | libdbpp/error.h | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/libdbpp/error.h b/libdbpp/error.h index 8e5c659..6e8ab18 100644 --- a/libdbpp/error.h +++ b/libdbpp/error.h @@ -2,22 +2,38 @@ #define DB_ERROR_H #include <stdlib.h> -#include <exception> +#include <exception.h> #include <visibility.h> namespace DB { /// Base class for database errors. - class DLL_PUBLIC Error : public virtual std::exception { }; - /// Base class for database connectivity errors. - class DLL_PUBLIC ConnectionError : public Error { + class DLL_PUBLIC Error : public virtual std::exception { + }; + + /// Exception thrown when attempting to bulk upload with a connector that doesn't support it. + class DLL_PUBLIC BulkUploadNotSupported : public Error { + public: + BulkUploadNotSupported(); + }; + + /// Exception thrown when a query returns an unsupported column type. + class DLL_PUBLIC ColumnTypeNotSupported : public Error { + public: + ColumnTypeNotSupported(); + }; + + /// Exception thrown on an attempt to convert betweem incompatible types. + class DLL_PUBLIC InvalidConversion : public AdHoc::Exception<Error> { public: - /// Default constructor, sets FailureTime to now. - ConnectionError(); - /// Construct with a specific failure time. - ConnectionError(time_t); + /// Create a new InvalidConversion exception with the names of the conversion types. + /// @param from Source type + /// @param to Destination type + InvalidConversion(const char * const from, const char * const to); - /// The time of connectivity failure. - const time_t FailureTime; + private: + std::string message() const throw() override; + const char * from; + const char * to; }; } |