diff --git a/chatterbot/storage/sql_storage.py b/chatterbot/storage/sql_storage.py index 0d3cd8b1a..227b972c6 100644 --- a/chatterbot/storage/sql_storage.py +++ b/chatterbot/storage/sql_storage.py @@ -274,7 +274,8 @@ def _session_finish(self, session, statement_text=None): session.commit() else: session.rollback() - except DatabaseError as e: - self.logger.error(statement_text, str(e.orig)) + except DatabaseError: + # Log the statement text and the exception + self.logger.exception(statement_text) finally: session.close()