db: better diagnostics when a query fails.

Print the error!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-08-14 10:57:52 +09:30
parent 9b4a7085c2
commit ed77edf4c6

View File

@@ -153,8 +153,7 @@ bool db_query_prepared_canfail(struct db_stmt *stmt)
void db_query_prepared(struct db_stmt *stmt)
{
if (!db_query_prepared_canfail(stmt))
db_fatal(stmt->db, "query failed: %s: %s",
stmt->location, stmt->query->query);
db_fatal(stmt->db, "query failed: %s", stmt->error);
}
bool db_step(struct db_stmt *stmt)