Open Drarok opened 6 years ago
Thanks for taking the time to post this and contribute a solution!
I don't have any insight on the problem at hand directly (your code looks good!) but one small problem you'll need to look into when doing a PR is compatibility with Python 2. You probably want to be using https://pythonhosted.org/six/#six.raise_from instead of raise X from Y
. The project is already using six
for compatibility.
If we fix compatibility I don't know of any bad side effects, so if it helps you its probably useful and deserves a PR!
Unfortunately, @Drarok's solution didn't work for me. It is incredibly frustrating not having a stack trace in the logs.
@feus4177 As a temporary workaround I changed this function at executor.py like
def handle_error(error):
import traceback; traceback.print_tb(error.original_error.__traceback__) # this line has been inserted
# type: (Union[GraphQLError, GraphQLLocatedError]) -> Optional[Any]
traceback = completed._traceback # type: ignore
exe_context.report_error(error, traceback)
return None
and it now prints stack traces.
In executor.py, there is the following code:
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: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!