Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't emit logs before rollback() #3125

Merged

Commits on Dec 21, 2022

  1. Don't emit logs before rollback()

    When handling exceptions, certain kinds of exceptions in either
    SQLAlchemy or in PyscoPG2 will cause references to the SQLAlchemy object
    instance to cause other exceptions.  For example, one might see:
    
        sqlalchemy.exc.PendingRollbackError: This Session's transaction has
        been rolled back due to a previous exception during flush. To begin
        a new transaction with this Session, first issue Session.rollback().
    
    By moving the log messages after the `rollback()` call, we avoid the
    extra mess caused.
    
    We also use the `self.logger` where possible, and we enhance the
    existing state transition error log with the object information, and
    add a debug log message on the success path.
    portante committed Dec 21, 2022
    Configuration menu
    Copy the full SHA
    343c1a0 View commit details
    Browse the repository at this point in the history