Refactor connection errors
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
調査の方向性
まず、issue で名前が挙げられている例外階層と接続エントリポイントを追跡します: connect()、handshake()、_opt_reconnect()。NetworkError、OperationalError、SchemaReloadException、Warning、NetworkWarning、ClusterDiscoveryWarning を確認し、要求された階層とメッセージの挙動を、関連する Database API 標準と比較します。残りのコネクタエラーと再接続の失敗が意図された階層に従い、警告の挙動が定義され、カバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
NetworkError is the case of OperationalError in fact. Moreover, .execute() can raise NetworkError and it'll contradict to the standard if NetworkError will not be a child of OperationalError:
The module should make all error information available through these exceptions or subclasses thereof:
The standard says "should" (not "must"), but I guess it may be important if an application or a library implements some retrying strategy based on a type of an error. OperationalError is transient by its meaning and can be retried.
SchemaReloadException also looks as a child of OperationalError. It should not be visible for a user, but while we have the whole hierarchy implement, it looks meaningful to either move SchemaReloadException outside of it or inherit properly.
More generally, all errors that base connector raises should be within this hierarchy, otherwise it will not be userful in practice. I left separate comments for other standard errors, where existing errors should be child of them.
=============
The Warning class is not used anywhere now and is not connected to existing NetworkWarning and ClusterDiscoveryWarning warnings. Now those warnings are just emitted using standard warnings module (see warn() function below), but it is not flexible enough to implement Cursor.messages and Connection.messages Database API extensions. We should provide API for tarantool.connection that allows to redefine this behaviour and collect those warnings after a request as sequence of tuples (exception class, exception value) as defined in the Database API. It'll be base for implementing the Database API <...>.messages extensions.
It is unclear for me, whether 'exception class' should be a subclass of this Warning class or warnings.UserWarning (we should inherit it from StandardError, not warnigns.Warning, which in a child of Exception). It is unclear, what exatcly 'exception value' should be: an instance of this Warning class or arbitrary value that describes what exactly appears? I would look to other implementations to better understand the idea of the standard.
=============
self.handshake() call in _opt_reconnect() should be try-catched and its error should be wrapped into NetworkError like it is done in connect(). Otherwise Exception or ValueError may lift up to a user, which is not expectable I guess.
Maybe there are other similar places, need to look around the code.
- 主要言語
- Python
- スター
- 108
- フォーク
- 51
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 1
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tarantool/tarantool-python のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
tarantool/tarantool-python#325 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
tarantool/tarantool-python#340 ·
-
`load_schema` race オープン
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
tarantool/tarantool-python#333 ·
-
3sp feature teamE
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
tarantool/tarantool-python#309 · コメント 1 件 ·
-
customer Database API
難易度 1/5 1時間未満 初心者へのやさしさ 45/100
tarantool/tarantool-python#307 · コメント 1 件 ·
tarantool/tarantool-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anthropics/skills#1811 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
speaches-ai/speaches#678 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
datalayer/mcp-compose#42 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
conda-forge/spacy-feedstock#177 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
UKGovernmentBEIS/inspect_evals#2523 ·