lib/sqlite: add "noexcept"

This commit is contained in:
Max Kellermann 2017-11-12 18:26:03 +01:00
parent ff9759c09d
commit fb01e41e8a
2 changed files with 6 additions and 5 deletions

View File

@ -24,13 +24,14 @@
#include <string>
static std::string
MakeSqliteErrorMessage(sqlite3 *db, const char *msg)
MakeSqliteErrorMessage(sqlite3 *db, const char *msg) noexcept
{
return std::string(msg) + ": " + sqlite3_errmsg(db);
}
SqliteError::SqliteError(sqlite3 *db, int _code, const char *msg)
SqliteError::SqliteError(sqlite3 *db, int _code, const char *msg) noexcept
:std::runtime_error(MakeSqliteErrorMessage(db, msg)), code(_code) {}
SqliteError::SqliteError(sqlite3_stmt *stmt, int _code, const char *msg)
SqliteError::SqliteError(sqlite3_stmt *stmt, int _code,
const char *msg) noexcept
:SqliteError(sqlite3_db_handle(stmt), _code, msg) {}

View File

@ -29,8 +29,8 @@ class SqliteError final : public std::runtime_error {
int code;
public:
SqliteError(sqlite3 *db, int _code, const char *msg);
SqliteError(sqlite3_stmt *stmt, int _code, const char *msg);
SqliteError(sqlite3 *db, int _code, const char *msg) noexcept;
SqliteError(sqlite3_stmt *stmt, int _code, const char *msg) noexcept;
int GetCode() const {
return code;