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 摘要。