@@ -89,6 +89,7 @@ def dispatch_request(self):
8989 is_batch = isinstance (data , list )
9090
9191 show_graphiql = not is_batch and self .should_display_graphiql (data )
92+ catch = HttpQueryError if show_graphiql else None
9293
9394 if not is_batch :
9495 assert isinstance (data , dict ), "GraphQL params should be a dict. Received {}." .format (data )
@@ -105,7 +106,7 @@ def dispatch_request(self):
105106 responses = [self .get_response (
106107 self .execute ,
107108 entry ,
108- show_graphiql ,
109+ catch ,
109110 only_allow_query ,
110111 ) for entry in data ]
111112
@@ -141,7 +142,7 @@ def dispatch_request(self):
141142 content_type = 'application/json'
142143 )
143144
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 ):
145146 params = self .get_graphql_params (data )
146147 try :
147148 execution_result = self .execute_graphql_request (
@@ -151,11 +152,8 @@ def get_response(self, execute, data, show_graphiql=False, only_allow_query=Fals
151152 params ,
152153 only_allow_query ,
153154 )
154- except HttpQueryError :
155- if show_graphiql :
156- execution_result = None
157- else :
158- raise
155+ except catch :
156+ execution_result = None
159157 return self .format_execution_result (execution_result , params .id , self .format_error )
160158
161159 @staticmethod
0 commit comments