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

Unable to locate original location of Exception

Offen
#207 3 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
372
Forks
175
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.