graphql-python / graphql-python/graphene-django
All exceptions during execution are considered "invalid" ExecutionResults, and return null data
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 760
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/graphql-python/graphene-django/blob/b0cba398a1bacd9305c50e784b862785348fca2d/graphene_django/views.py#L284-L285
Currently Graphene-Django assumes any exception during execution is cause for an invalid ExecutionResult, meaning I can't obtain partial data, and my data field is _"null"_.
This is an issue for several reasons, the most obvious being that my client should be able to obtain partial data, even on an exception during execution. Sometimes these exceptions are caused by user error (e.g. bad input).
graphql-core allows partial data to be sent on error:
https://github.com/graphql-python/graphql-core/blob/fa4eeda36029680205e20059379e89189b946032/graphql/execution/base.py#L23-L39
What's the rationale behind setting `invalid=True` on all execution errors?
EDIT:
From this tutorial it's clear that this behavior isn't what graphql-python expects:
https://www.howtographql.com/graphql-python/6-error-handling/
Contributor guide
Assessment
This issue has not been assessed yet.