diff --git a/torba/client/basedatabase.py b/torba/client/basedatabase.py index b6ead4aea..722bb9de1 100644 --- a/torba/client/basedatabase.py +++ b/torba/client/basedatabase.py @@ -54,12 +54,13 @@ class AIOSQLite: def __run_transaction(self, fun: Callable[[sqlite3.Connection, Any, Any], Any], *args, **kwargs): self.connection.execute('begin') try: - fun(self.connection, *args, **kwargs) # type: ignore - except (Exception, OSError): + result = fun(self.connection, *args, **kwargs) # type: ignore + self.connection.commit() + return result + except (Exception, OSError) as e: + log.exception('Error running transaction:', exc_info=e) self.connection.rollback() raise - else: - self.connection.commit() def constraints_to_sql(constraints, joiner=' AND ', prepend_key=''):