mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-05-15 21:33:47 +03:00
Merge pull request #1 from no-dap/bugfix/execution-result
Return error result if execution result contains errors
This commit is contained in:
commit
a5d0125e05
|
@ -273,7 +273,7 @@ class GraphQLView(View):
|
|||
# executor is not a valid argument in all backends
|
||||
extra_options["executor"] = self.executor
|
||||
|
||||
return document.execute(
|
||||
execution_result = document.execute(
|
||||
root=self.get_root_value(request),
|
||||
variables=variables,
|
||||
operation_name=operation_name,
|
||||
|
@ -281,6 +281,9 @@ class GraphQLView(View):
|
|||
middleware=self.get_middleware(request),
|
||||
**extra_options
|
||||
)
|
||||
if execution_result.errors:
|
||||
return ExecutionResult(errors=execution_result.errors, invalid=True)
|
||||
return execution_result
|
||||
except Exception as e:
|
||||
return ExecutionResult(errors=[e], invalid=True)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user