MagicStack / MagicStack/asyncpg

Document exceptions

未关闭
#441 0 条评论 9 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
8.1k
派生
468
PR 合并指标
30 天内没有已合并 PR

描述

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.

>>> 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

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 asyncpg 的异常类和 issue 中列出的异常列表开始,将基础异常和 API 异常与由 SQLSTATE 生成的异常分开。记录可用的类及其描述,包括 SQLSTATE 的覆盖范围;当项目文档涵盖异常参考时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
postgresql, python
领域
databases, documentation
Issue 类型
文档
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。