Refactor connection errors
還沒有人認領這個 Issue。
評估
研究方向
首先追蹤 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
- 分支
- 50
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 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 ·
-
難度 3/5 1-2 天 新手友好度 48/100
tarantool/tarantool-python#333 ·
-
3sp feature teamE
難度 5/5 一週以上 新手友好度 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
-
python-version
難度 1/5 1 小時以內 新手友好度 88/100
-
bug
難度 2/5 1-3 小時 新手友好度 62/100
維護者通常 1 天內回覆
-
bug javascript P2-medium python release:v3.1
難度 2/5 1-3 小時 新手友好度 68/100
adrirubio/claude-deck#546 ·
維護者通常 1 天內回覆
-
area: desktop area: website priority: P2 type: feature
難度 2/5 1-3 小時 新手友好度 62/100
appandflow/stim#3411 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1 小時以內 新手友好度 88/100
baptistehamon/lsapy#185 ·
維護者通常 1 天內回覆