aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/sqlite.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/sqlite.hh')
-rw-r--r--src/libstore/sqlite.hh26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/libstore/sqlite.hh b/src/libstore/sqlite.hh
index 99f0d56ce..3a4ad8633 100644
--- a/src/libstore/sqlite.hh
+++ b/src/libstore/sqlite.hh
@@ -96,10 +96,30 @@ struct SQLiteTxn
};
-MakeError(SQLiteError, Error);
-MakeError(SQLiteBusy, SQLiteError);
+struct SQLiteError : Error
+{
+ const char *path;
+ int errNo, extendedErrNo;
+
+ template<typename... Args>
+ [[noreturn]] static void throw_(sqlite3 * db, const std::string & fs, const Args & ... args) {
+ throw_(db, hintfmt(fs, args...));
+ }
+
+protected:
+
+ SQLiteError(const char *path, int errNo, int extendedErrNo, hintformat && hf);
-[[noreturn]] void throwSQLiteError(sqlite3 * db, const FormatOrString & fs);
+ template<typename... Args>
+ SQLiteError(const char *path, int errNo, int extendedErrNo, const std::string & fs, const Args & ... args)
+ : SQLiteError(path, errNo, extendedErrNo, hintfmt(fs, args...))
+ { }
+
+ [[noreturn]] static void throw_(sqlite3 * db, hintformat && hf);
+
+};
+
+MakeError(SQLiteBusy, SQLiteError);
void handleSQLiteBusy(const SQLiteBusy & e);