graphql-python / graphql-python/graphql-core-legacy

Unable to locate original location of Exception

Ouverte
#207 3 commentaires 3 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
372
Forks
175
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

In [executor.py](https://github.com/graphql-python/graphql-core/blob/master/graphql/execution/executor.py#L536), there is the following code:

```py
if isinstance(result, Exception):
raise GraphQLLocatedError(field_asts, original_error=result, path=path)
```

This appears to swallow the original error (`result`) as it doesn't appear in any tracebacks, leading me to lose my mind trying to work out where an error is actually being thrown. In my local install I have changed it to this in order to [chain the exceptions](https://www.python.org/dev/peps/pep-3134/):

```py
if isinstance(result, Exception):
raise GraphQLLocatedError(field_asts, original_error=result, path=path) from result
```

This gives me the full original exception's stack trace to look at when I'm debugging, and allows me to regain some sanity. I don't know if there any any knock-on effects though, which is why I didn't create this as a pull request. I'd love to hear your thoughts!

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Examinez graphql/execution/executor.py autour de la ligne 536 ainsi que le comportement lié du chaînage des exceptions de PEP 3134. Vérifiez si le résultat du chaînage préserve le comportement de GraphQLLocatedError et la sortie du traceback, y compris les éventuels effets indirects ; le travail sera terminé lorsque la modification sera validée sans perturber la gestion des erreurs existante.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
api, backend
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.