Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print exception traceback of GraphQLLocatedError #1121

Closed
karlosss opened this issue Feb 16, 2021 · 1 comment · Fixed by #1122
Closed

Print exception traceback of GraphQLLocatedError #1121

karlosss opened this issue Feb 16, 2021 · 1 comment · Fixed by #1122

Comments

@karlosss
Copy link

Hi!

I just spent the whole afternoon trying to find out how to display the exception traceback when the exception happens as a result of a request. I have a KeyError somewhere in my code and all I can see is

{
  "errors": [
    {
      "message": "'username'",
      "locations": [
        {
          "line": 17,
          "column": 3
        }
      ],
      "path": [
        "CustomUserUpdate"
      ]
    }
  ],
  "data": null
}

Would be way more informative if either the message field could somehow show the whole traceback, or, preferably, the traceback was printed into the console.

How do I achieve that, if possible at all?

Thanks!

@karlosss
Copy link
Author

Wow, that was fast! In the meantime I found a workaround:

File promise/promise.py, _settle_promise() method, add the following code to line 314:

if traceback is not None:
    import traceback as tb
    tb.print_tb(traceback)
    print("{}: {}".format(value.__class__.__name__, value))

and whenever an exception appears, its traceback is printed to stdout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant