diff --git a/momoko/connection.py b/momoko/connection.py index b0ba7c8..6598eb4 100644 --- a/momoko/connection.py +++ b/momoko/connection.py @@ -821,10 +821,10 @@ def exec_statements(future): cursor = future.result() cursors.append(cursor) except Exception as error: - if not auto_rollback: - transaction_future.set_exc_info(sys.exc_info()) - else: + if auto_rollback and not self.closed: self._rollback(transaction_future, error) + else: + transaction_future.set_exc_info(sys.exc_info()) return try: