graphql-python / graphql-python/flask-graphql
Flask's app.errorhandler decorator dosen't work for GraphQLLocatedError
- Linguagem predominante
- Python
- Estrelas
- 1.3k
- Forks
- 139
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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 -
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Comece em graphql/execution/executor.py, especialmente em complete_value_catching_error e complete_value, e depois rastreie a requisição /graphql até o registro de app.errorhandler do Flask. Determine por que GraphQLLocatedError ignora o handler reportado; considera-se concluído quando o comportamento do handler estiver coberto de forma reproduzível e a exceção não ignorar mais o tratamento de erros do Flask.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- flask, graphql, python
- Domínio
- api, backend
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 25/100