[geary/mjog/921-db-locked: 3/3] Geary.Db.DatabaseConnection: Add SQL debug logging when txns fail




commit 87999d35947c23918a982c95aea7dccfaedc8b02
Author: Michael Gratton <mike vee net>
Date:   Fri Sep 4 00:39:30 2020 +1000

    Geary.Db.DatabaseConnection: Add SQL debug logging when txns fail
    
    This isn't a good place to do it, but neither GLib's error model not the
    engine's database model makes it possible to getting access to txn
    state otherwise at the moment.

 src/engine/db/db-database-connection.vala | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/engine/db/db-database-connection.vala b/src/engine/db/db-database-connection.vala
index 1e5dc41a8..ef0908221 100644
--- a/src/engine/db/db-database-connection.vala
+++ b/src/engine/db/db-database-connection.vala
@@ -208,6 +208,15 @@ public class Geary.Db.DatabaseConnection : Context, Connection, Logging.Source {
         }
 
         if (caught_err != null) {
+            // XXX this really should be passed up with the error, but
+            // GLib's error model does not allow that
+            debug(
+                "Error thrown while executing transaction: %s",
+                caught_err.message
+            );
+            foreach (var statement in txn_cx.transaction_log) {
+                debug(" - %s", statement);
+            }
             throw caught_err;
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]