@@ -145,19 +145,15 @@ def _default_headers(self):
145
145
@retry .Retry (predicate = retry .if_exception_type (
146
146
labelbox .exceptions .InternalServerError ,
147
147
labelbox .exceptions .TimeoutError ))
148
- def execute (
149
- self ,
150
- query = None ,
151
- params = None ,
152
- data = None ,
153
- files = None ,
154
- timeout = 60.0 ,
155
- experimental = False ,
156
- error_log_key = "message" ,
157
- raise_return_resource_not_found = False ,
158
- error_handlers : Optional [Dict [str , Callable [[requests .models .Response ],
159
- None ]]] = None
160
- ) -> Dict [str , Any ]:
148
+ def execute (self ,
149
+ query = None ,
150
+ params = None ,
151
+ data = None ,
152
+ files = None ,
153
+ timeout = 60.0 ,
154
+ experimental = False ,
155
+ error_log_key = "message" ,
156
+ raise_return_resource_not_found = False ):
161
157
""" Sends a request to the server for the execution of the
162
158
given query.
163
159
@@ -171,13 +167,6 @@ def execute(
171
167
files (dict): file arguments for request
172
168
timeout (float): Max allowed time for query execution,
173
169
in seconds.
174
- raise_return_resource_not_found: By default the client relies on the caller to raise the correct exception when a resource is not found.
175
- If this is set to True, the client will raise a ResourceNotFoundError exception automatically.
176
- This simplifies processing.
177
- We recommend to use it only of api returns a clear and well-formed error when a resource not found for a given query.
178
- error_handlers (dict): A dictionary mapping graphql error code to handler functions.
179
- Allows a caller to handle specific errors reporting in a custom way or produce more user-friendly readable messages.
180
-
181
170
Returns:
182
171
dict, parsed JSON response.
183
172
Raises:
@@ -341,12 +330,7 @@ def get_error_status_code(error: dict) -> int:
341
330
# TODO: fix this in the server API
342
331
internal_server_error = check_errors (["INTERNAL_SERVER_ERROR" ],
343
332
"extensions" , "code" )
344
- error_code = "INTERNAL_SERVER_ERROR"
345
-
346
333
if internal_server_error is not None :
347
- if error_handlers and error_code in error_handlers :
348
- handler = error_handlers [error_code ]
349
- handler (response )
350
334
message = internal_server_error .get ("message" )
351
335
error_status_code = get_error_status_code (internal_server_error )
352
336
if error_status_code == 400 :
0 commit comments