Skip to content

Commit d686acd

Browse files
author
Val Brodsky
committed
Add support for custom handling of MALFORMED_REQUEST errors and bump lbox-clients version
1 parent 2beab37 commit d686acd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

libs/lbox-clients/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "lbox-clients"
3-
version = "1.0.0"
3+
version = "1.1.0"
44
description = "This module contains client sdk uses to conntect to the Labelbox API and backends"
55
authors = [
66
{ name = "Labelbox", email = "engineering@labelbox.com" }

libs/lbox-clients/src/lbox/request_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,13 @@ def get_error_status_code(error: dict) -> int:
304304
malformed_request_error = check_errors(
305305
["MALFORMED_REQUEST"], "extensions", "code"
306306
)
307+
308+
error_code = "MALFORMED_REQUEST"
307309
if malformed_request_error is not None:
310+
if error_handlers and error_code in error_handlers:
311+
handler = error_handlers[error_code]
312+
handler(response)
313+
return None
308314
raise exceptions.MalformedQueryException(
309315
malformed_request_error[error_log_key]
310316
)

0 commit comments

Comments
 (0)