From 1f2d732775883a519fca628ec538368d9785f9f6 Mon Sep 17 00:00:00 2001 From: Alexey Subbotin Date: Mon, 23 Jan 2017 16:06:36 +0100 Subject: [PATCH] Return 400 status code if result has any error All exceptions in `graphql.execution.executor.resolve_or_error` will be returned as `GraphQLLocatedError` element on `errors` attribute. --- graphene_django/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphene_django/views.py b/graphene_django/views.py index a68fd53..0887ee7 100644 --- a/graphene_django/views.py +++ b/graphene_django/views.py @@ -154,7 +154,7 @@ class GraphQLView(View): if execution_result.errors: response['errors'] = [self.format_error(e) for e in execution_result.errors] - if execution_result.invalid: + if execution_result.invalid or execution_result.errors: status_code = 400 else: response['data'] = execution_result.data