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 transaction state otherwise at the moment.
This commit is contained in:
parent
51ad8458a9
commit
dcad419b03
1 changed files with 18 additions and 1 deletions
|
|
@ -191,8 +191,16 @@ public class Geary.Db.DatabaseConnection : Context, Connection {
|
|||
// perform the transaction
|
||||
outcome = cb(txn_cx, cancellable);
|
||||
} catch (GLib.Error err) {
|
||||
if (!(err is GLib.IOError.CANCELLED))
|
||||
if (!(err is GLib.IOError.CANCELLED)) {
|
||||
debug("Connection.exec_transaction: transaction threw error: %s", err.message);
|
||||
// XXX txn logs really should be passed up with the
|
||||
// error, or made available after the transaction, but
|
||||
// neither GLib's error model nor Db's model allows
|
||||
// that
|
||||
foreach (var statement in txn_cx.transaction_log) {
|
||||
debug(" - %s", statement);
|
||||
}
|
||||
}
|
||||
|
||||
caught_err = err;
|
||||
}
|
||||
|
|
@ -205,6 +213,15 @@ public class Geary.Db.DatabaseConnection : Context, Connection {
|
|||
} catch (GLib.Error err) {
|
||||
debug("Connection.exec_transaction: Unable to %s transaction: %s", outcome.to_string(),
|
||||
err.message);
|
||||
if (caught_err == null) {
|
||||
// XXX as per above, txn logs really should be passed up
|
||||
// with the error, or made available after the
|
||||
// transaction, but neither GLib's error model nor Db's
|
||||
// model allows that
|
||||
foreach (var statement in txn_cx.transaction_log) {
|
||||
debug(" - %s", statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caught_err != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue