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

Unable to locate original location of Exception

Open
#207 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
372
Forks
175
PR merge metrics
No merged PRs in 30d

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!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.