00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef TNTDB_ERROR_H
00030 #define TNTDB_ERROR_H
00031
00032 #include <stdexcept>
00033 #include <string>
00034
00035 namespace tntdb
00036 {
00041 class Error : public std::runtime_error
00042 {
00043 public:
00045 explicit Error(const std::string& msg);
00046 };
00047
00051 class NotFound : public Error
00052 {
00053 public:
00054 NotFound();
00055 };
00056
00061 class NullValue : public Error
00062 {
00063 public:
00064 NullValue();
00065 };
00066
00070 class TypeError : public Error
00071 {
00072 public:
00073 explicit TypeError(const std::string& msg = "type error");
00074 };
00075
00079 class SqlError : public Error
00080 {
00081 std::string sql;
00082
00083 public:
00084 explicit SqlError(const std::string& sql_, const std::string& msg = "sql error");
00085 ~SqlError() throw()
00086 { }
00087
00088 const std::string& getSql() const { return sql; }
00089 };
00090
00091 class FieldNotFound : public Error
00092 {
00093 std::string field;
00094
00095 public:
00096 explicit FieldNotFound(const std::string& field);
00097 ~FieldNotFound() throw() { }
00098
00099 const std::string& getField() const { return field; }
00100 };
00101 }
00102
00103 #endif // TNTDB_ERROR_H
00104