asyncpg
asyncpg copied to clipboard
connection error
It is bit hard to figure out, which exceptions I should catch if I want to recover my application from connection errors.
So far
OSError- when database is downCannotConnectNowErrorwhen PostgreSQL is startingConnectionDoesNotExistErrorwhen connection is removed from connection poolInterfaceErrorwhen message contains one ofconnection has been released back to the poolthe underlying connection is closed
It seems I should add one PostgresConnectionError deriving classes as well? Anything else?
Can you share the code for the error classes you made @wrobell ? I am having the same problem as you are (catching connection errors) and I wonder how you resolved it
@fugacityengr Please take a look at catch_conn_error function in https://gitlab.com/n23/n23/-/blob/master/n23/storage/pg/core.py. This logic serves me well for almost two years, now.
Thank you so much! Helped me a lot