Add format-string version of tui_abort and use it to display SQLite errors

This commit is contained in:
Daniel Schulte 2020-11-22 18:11:58 +01:00
parent 1f64677fcf
commit 862c56d91e
4 changed files with 29 additions and 2 deletions

View file

@ -30,7 +30,7 @@ size_t current_page_count = 0;
size_t title_offset = 0;
bool any_title_in_next_half = false;
#define SC(x) { const int res = (x); if(res != SQLITE_OK && res != SQLITE_ROW && res != SQLITE_DONE) { fprintf(stderr, "%s failed: (%d) %s\n", #x, res, sqlite3_errstr(res)); std::abort(); }}
#define SC(x) { const int res = (x); if(res != SQLITE_OK && res != SQLITE_ROW && res != SQLITE_DONE) { tui_abort("Database error:\n%s failed: (%d) %s", #x, res, sqlite3_errstr(res)); }}
static termpaint_attr* get_attr(const AttributeSetType type, const bool highlight=false)
{