Skip to content

Commit b799b9e

Browse files
authored
Merge pull request #650 from ably/fix-from-exception
fix: fallback to type name in `from_exception` when exception has no message
2 parents 82e16dc + bdddd04 commit b799b9e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

ably/util/exceptions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ def decode_error_response(response):
7777
def from_exception(e):
7878
if isinstance(e, AblyException):
7979
return e
80-
return AblyException(f"Unexpected exception: {e}", 500, 50000)
80+
exc_type = type(e).__name__
81+
exc_msg = str(e)
82+
if exc_msg:
83+
message = f"{exc_type}: {exc_msg}"
84+
else:
85+
message = exc_type
86+
return AblyException(f"Unexpected exception: {message}", 500, 50000)
8187

8288
@staticmethod
8389
def from_dict(value: dict):

0 commit comments

Comments
 (0)