Skip to content

Commit f886386

Browse files
author
Val Brodsky
committed
Cleanup exception printing for LabelboxError
1 parent 7994c48 commit f886386

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

libs/labelbox/src/labelbox/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def execute(
148148
experimental=False,
149149
error_log_key="message",
150150
raise_return_resource_not_found=False,
151-
error_handlers: Optional[Dict[str, Callable[[Dict[str, Any]],
151+
error_handlers: Optional[Dict[str, Callable[[requests.models.Response],
152152
None]]] = None
153153
) -> Dict[str, Any]:
154154
""" Sends a request to the server for the execution of the

libs/labelbox/src/labelbox/exceptions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ def __init__(self, message, cause=None):
1616
self.cause = cause
1717

1818
def __str__(self):
19-
return self.message + str(self.args)
19+
exception_message = self.message
20+
if self.cause is not None:
21+
exception_message += " (caused by: %s)" % self.cause
22+
return exception_message
2023

2124

2225
class AuthenticationError(LabelboxError):

0 commit comments

Comments
 (0)