graphql-python / graphql-python/flask-graphql

Flask's app.errorhandler decorator dosen't work for GraphQLLocatedError

Offen
#49 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
1.3k
Forks
139
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I am making an extension library [flask-graphql-auth](https://github.com/devArtoria/flask-graphql-auth). and error handler by using flask's app.errorhandler is being planed for the 1.0 release. I checked that if my library caused an exception like JWTDecodeError, an GraphQLLocatedError occurred. However, the flask can not handle the error by app.errorhandler. Is this a bug?

```
@app.errorhandler(GraphQLLocatedError)
def handle(e):
return 401
```
I wrote this code. but stacktrace appears :(
```
...
Traceback (most recent call last):
File "C:\Users\Lewis\OneDrive\Documents\Development Repos\flask-graphql-auth\venv\lib\site-packages\graphql\execution\executor.py", line 330, in complete_value_catching_error
exe_context, return_type, field_asts, info, result)
File "C:\Users\Lewis\OneDrive\Documents\Development Repos\flask-graphql-auth\venv\lib\site-packages\graphql\execution\executor.py", line 383, in complete_value
raise GraphQLLocatedError(field_asts, original_error=result)
graphql.error.located_error.GraphQLLocatedError: Signature verification failed
127.0.0.1 - - [21/Jul/2018 12:48:30] "POST /graphql? HTTP/1.1" 200 -
```

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.