From 8e1461b3f184c277c0da5a60e2e34ea7ddd77424 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Fri, 17 Feb 2023 02:04:48 +0000 Subject: [PATCH] Catch more sqlite errors. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4182 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.js.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ssb.js.c b/src/ssb.js.c index 35affc0f..33325b73 100644 --- a/src/ssb.js.c +++ b/src/ssb.js.c @@ -440,6 +440,11 @@ static void _tf_ssb_sqlAsync_work(uv_work_t* work) } } } + sql_work->result = r; + if (r != SQLITE_OK && r != SQLITE_DONE) + { + sql_work->error = tf_strdup(sqlite3_errmsg(db)); + } _tf_ssb_sql_append(&sql_work->rows, &sql_work->rows_count, &(uint8_t[]) { 0 }, 1); sqlite3_finalize(statement); } @@ -516,7 +521,7 @@ static void _tf_ssb_sqlAsync_after_work(uv_work_t* work, int status) tf_free(sql_work->rows); JSValue result = JS_UNDEFINED; - if (sql_work->result == SQLITE_OK) + if (sql_work->result == SQLITE_OK || sql_work->result == SQLITE_DONE) { result = JS_Call(context, sql_work->promise[0], JS_UNDEFINED, 0, NULL); tf_util_report_error(context, result);