MagicStack / MagicStack/asyncpg

Document exceptions

Open
#441 0 comments 9 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8.1k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

Please add the asyncpg exceptions to the documentation. I have no trouble reading source code, so was pleasantly surprised to find how rich the included exception classes are.

```python
>>> exceptions = sorted((o for o in vars(asyncpg).values() if isinstance(o, type) and issubclass(o, Exception)), key=lambda o: o.__name__)
>>> for exc in exceptions:
... if getattr(exc, 'sqlstate', None): continue # looong list otherwise
... print(exc.__name__)
... if exc.__doc__: print(exc.__doc__)
... print()
...
FatalPostgresError
A fatal error that should result in server disconnection.

InterfaceError
An error caused by improper use of asyncpg API.

InterfaceWarning
A warning caused by an improper use of asyncpg API.

InternalClientError
All unexpected errors not classified otherwise.

OutdatedSchemaCacheError
A value decoding error caused by a schema change before row fetching.

PostgresError
Base class for all Postgres errors.

ProtocolError
Unexpected condition in the handling of PostgreSQL protocol input.

UnknownPostgresError
An error with an unknown SQLSTATE code.

>>> # generated exceptions for all possible sqlstate values
...
>>> sum(1 for exc in exceptions if getattr(exc, 'sqlstate', None))
240
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the asyncpg exception classes and the exception list shown in the issue, separating the base and API exceptions from the SQLSTATE-generated exceptions. Document the available classes and their descriptions, including the SQLSTATE coverage; done means the exception reference is covered in the project documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.