10#define SL3__ERROR_HPP_
17#include <sl3/config.hpp>
62 class LIBSL3_API
Error :
public std::runtime_error
67 using std::runtime_error::runtime_error;
90 template <ErrCode ec>
class LIBSL3_API
ErrType final :
public Error
147 ErrType (
int sl3ec,
const char* sl3msg,
const std::string& msg)
148 :
Error (
"(" +
std::to_string (sl3ec) +
":" + sl3msg +
"):" + msg)
150 , _sqlite_msg (sl3msg)
166 return ErrCode::SQL3Error;
195 std::string _sqlite_msg;
205#define ASSERT_EXCEPT(exp, except) \
207 throw except (std::string (__FUNCTION__) + ": " + #exp)
packaging an error from sqlite3. This exception will be thrown if sqlite3 reports an error.
Definition: error.hpp:139
ErrType(int sl3ec, const char *sl3msg, const std::string &msg)
c'tor
Definition: error.hpp:147
int SQLiteErrorCode() const
Get the sqlite3 error code.
Definition: error.hpp:174
ErrCode getId() const override
Get ErrCode.
Definition: error.hpp:164
const std::string & SQLiteErrorMessage() const
Get the sqlite3 error message.
Definition: error.hpp:188
ErrType(int sl3ec, const char *sl3msg)
c'tor
Definition: error.hpp:159
Object class representing an ErrCode.
Definition: error.hpp:91
ErrCode getId() const override
Get ErrCode.
Definition: error.hpp:101
Exception base type.
Definition: error.hpp:63
virtual ErrCode getId() const =0
Get ErrCode.
Namespace of libSL3.
Definition: columns.hpp:18
ErrCode
Error codes.
Definition: error.hpp:30
@ SQL3Error
sqlite3 error happened
@ OutOfRange
index op out of range
@ NoConnection
no database
@ UNEXPECTED
for everything that happens unexpected
@ NullValueAccess
accessing a value that is Null
@ TypeMisMatch
type cast problem
LIBSL3_API std::ostream & operator<<(std::ostream &stm, const sl3::DbValue &v)
Stream op for a DbValue.
constexpr const char * ErrCodeName(ErrCode ec)
get textual representantion (the name) of an ErrCode
Definition: error.hpp:45