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

Unable to locate original location of Exception

Aperta
#207 3 commenti 3 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
372
Fork
175
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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!

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.