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

Fixed #33160 -- Avoided suppressing query errors in _nodb_cursor() on PostgreSQL. #14918

Merged
merged 2 commits into from Oct 1, 2021

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Sep 30, 2021

@felixxm
Copy link
Member

felixxm commented Sep 30, 2021

@blueyed Thanks for this patch 👍 Can we add a small test? e.g.

    def test_nodb_cursor_reraise_exceptions(self):
        with self.assertRaisesMessage(DatabaseError, 'exception'):
            with connection._nodb_cursor() as cursor:
                raise DatabaseError('exception') 

@blueyed
Copy link
Contributor Author

blueyed commented Sep 30, 2021

@felixxm
Sure, thanks for the test - pushed slightly modified.

btw: previously it would also throw RuntimeError("generator didn't stop after throw()") in this case, since it first yielded, then got the exception, and yielded again - while it is only meant to yield once, which is fixed by this patch.

@felixxm felixxm changed the title Fixed #33160 - Made postgresql _nodb_cursor only transform connection errors into warnings. Fixed #33160 -- Avoided suppressing query errors in _nodb_cursor() on PostgreSQL. Oct 1, 2021
@felixxm felixxm merged commit 98c8bf1 into django:main Oct 1, 2021
@felixxm
Copy link
Member

felixxm commented Oct 1, 2021

@blueyed Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants