Refactor connection errors
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
Piste de recherche
Commencez par retracer la hiérarchie des exceptions et les points d’entrée de connexion nommés dans l’issue : connect(), handshake() et _opt_reconnect(). Examinez NetworkError, OperationalError, SchemaReloadException, Warning, NetworkWarning et ClusterDiscoveryWarning, puis comparez le comportement demandé pour la hiérarchie et les messages avec la norme Database API correspondante. Le travail est terminé lorsque les erreurs restantes du connecteur et les échecs de reconnexion suivent la hiérarchie prévue et que le comportement des avertissements est défini et couvert.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 108
- Forks
- 51
- Merge moyen
- 1 j 8 h
- PR mergées (30 j)
- 1
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de tarantool/tarantool-python
-
flake8 noqa disables all errorsOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
tarantool/tarantool-python#325 · 1 commentaire ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
tarantool/tarantool-python#340 ·
-
`load_schema` raceOuverte
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
tarantool/tarantool-python#333 ·
-
3sp feature teamE
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
tarantool/tarantool-python#309 · 1 commentaire ·
-
Need to fix dbapi implementationOuvertecustomer Database API
Difficulté 1/5 Moins d'une heure Accessibilité débutants 45/100
tarantool/tarantool-python#307 · 1 commentaire ·
Toutes les issues de tarantool/tarantool-python
Issues similaires
-
Broken links found in docsOuvertedocs pydanty:is-working
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
pydantic/pydantic-ai#8863 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
run-llama/llama_index#23278 ·
Les mainteneurs répondent en général sous 2 jours
-
documentation from-review-extraction github-actions priority: low severity:nit
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
LearningCircuit/local-deep-research#6946 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
oracle/langchain-oracle#323 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
tenstorrent/tt-metal#58057 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour