@@ -89,6 +89,7 @@ def dispatch_request(self):
89
89
is_batch = isinstance (data , list )
90
90
91
91
show_graphiql = not is_batch and self .should_display_graphiql (data )
92
+ catch = HttpQueryError if show_graphiql else None
92
93
93
94
if not is_batch :
94
95
assert isinstance (data , dict ), "GraphQL params should be a dict. Received {}." .format (data )
@@ -105,7 +106,7 @@ def dispatch_request(self):
105
106
responses = [self .get_response (
106
107
self .execute ,
107
108
entry ,
108
- show_graphiql ,
109
+ catch ,
109
110
only_allow_query ,
110
111
) for entry in data ]
111
112
@@ -141,7 +142,7 @@ def dispatch_request(self):
141
142
content_type = 'application/json'
142
143
)
143
144
144
- def get_response (self , execute , data , show_graphiql = False , only_allow_query = False ):
145
+ def get_response (self , execute , data , catch = None , only_allow_query = False ):
145
146
params = self .get_graphql_params (data )
146
147
try :
147
148
execution_result = self .execute_graphql_request (
@@ -151,11 +152,8 @@ def get_response(self, execute, data, show_graphiql=False, only_allow_query=Fals
151
152
params ,
152
153
only_allow_query ,
153
154
)
154
- except HttpQueryError :
155
- if show_graphiql :
156
- execution_result = None
157
- else :
158
- raise
155
+ except catch :
156
+ execution_result = None
159
157
return self .format_execution_result (execution_result , params .id , self .format_error )
160
158
161
159
@staticmethod
0 commit comments