MagicStack / MagicStack/asyncpg

connection error

Open
#513 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.1k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

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 down
  • CannotConnectNowError when PostgreSQL is starting
  • ConnectionDoesNotExistError when connection is removed from connection pool
  • InterfaceError when message contains one of
    • connection has been released back to the pool
    • the underlying connection is closed

It seems I should add one PostgresConnectionError deriving classes as well? Anything else?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing exception definitions and the connection error paths described in the issue. Compare how OSError, CannotConnectNowError, ConnectionDoesNotExistError, and InterfaceError are raised, then determine whether a unified PostgresConnectionError hierarchy covers the listed recovery cases. Done means the desired exception API and its compatibility impact are agreed on.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.