| 8 | namespace sqlite { |
| 9 | |
| 10 | class sqlite_exception: public std::runtime_error { |
| 11 | public: |
| 12 | sqlite_exception(const char* msg, std::string sql, int code = -1): runtime_error(msg), code(code), sql(sql) {} |
| 13 | sqlite_exception(int code, std::string sql): runtime_error(sqlite3_errstr(code)), code(code), sql(sql) {} |
| 14 | int get_code() const {return code & 0xFF;} |
| 15 | int get_extended_code() const {return code;} |
| 16 | std::string get_sql() const {return sql;} |
| 17 | private: |
| 18 | int code; |
| 19 | std::string sql; |
| 20 | }; |
| 21 | |
| 22 | namespace errors { |
| 23 | //One more or less trivial derived error class for each SQLITE error. |
no outgoing calls
no test coverage detected