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
- 派生
- 51
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 1
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 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
-
bug confirmed issue
难度 2/5 1-3 小时 新手友好度 75/100
open-webui/open-webui#30750 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
good first issue
难度 1/5 1 小时以内 新手友好度 90/100