10#define SL3__ERROR_HPP_
17#include <sl3/config.hpp>
64 class LIBSL3_API
Error :
public std::runtime_error
69 using std::runtime_error::runtime_error;
93 template <ErrCode ec>
class LIBSL3_API ErrType final :
public Error
151 ErrType (
int sl3ec,
const char* sl3msg,
const std::string& msg)
152 :
Error (
"(" +
std::to_string (sl3ec) +
":" + sl3msg +
"):" + msg)
154 , _sqlite_msg (sl3msg)
201 std::string _sqlite_msg;
211#define ASSERT_EXCEPT(exp, except) \
213 throw except (std::string (__FUNCTION__) + ": " + #exp)
ErrType(int sl3ec, const char *sl3msg, const std::string &msg)
c'tor
Definition error.hpp:151
int SQLiteErrorCode() const
Get the sqlite3 error code.
Definition error.hpp:179
ErrCode getId() const override
Get ErrCode.
Definition error.hpp:169
const std::string & SQLiteErrorMessage() const
Get the sqlite3 error message.
Definition error.hpp:194
ErrType(int sl3ec, const char *sl3msg)
c'tor
Definition error.hpp:164
Object class representing an ErrCode.
Definition error.hpp:94
ErrCode getId() const override
Get ErrCode.
Definition error.hpp:104
Exception base type.
Definition error.hpp:65
virtual ErrCode getId() const =0
Get ErrCode.
Namespace of libSL3.
Definition columns.hpp:18
ErrType< ErrCode::SQL3Error > SQLite3Error
Alias for ErrType<ErrCode::SQL3Error>.
Definition error.hpp:209
ErrType< ErrCode::NoConnection > ErrNoConnection
error that will be thrown if no open database was available but needed
Definition error.hpp:111
ErrType< ErrCode::OutOfRange > ErrOutOfRange
thrown if an index op is out of range
Definition error.hpp:114
ErrCode
Error codes.
Definition error.hpp:30
@ SQL3Error
sqlite3 error happened
Definition error.hpp:31
@ OutOfRange
index op out of range
Definition error.hpp:33
@ NoConnection
no database
Definition error.hpp:32
@ UNEXPECTED
for everything that happens unexpected
Definition error.hpp:36
@ NullValueAccess
accessing a value that is Null
Definition error.hpp:35
@ TypeMisMatch
type cast problem
Definition error.hpp:34
ErrType< ErrCode::NullValueAccess > ErrNullValueAccess
thrown in case of accessing a Null value field/parameter
Definition error.hpp:122
LIBSL3_API std::ostream & operator<<(std::ostream &stm, const sl3::DbValue &v)
Stream op for a DbValue.
ErrType< ErrCode::UNEXPECTED > ErrUnexpected
Definition error.hpp:126
ErrType< ErrCode::TypeMisMatch > ErrTypeMisMatch
thrown in case of an incorrect type usage
Definition error.hpp:119
constexpr const char * ErrCodeName(ErrCode ec)
Get the textual representation (the name) of an ErrCode.
Definition error.hpp:46