Skip to content

Commit

Permalink
Fix #1181 Add exception handling for socket mode - socket.timeout: th…
Browse files Browse the repository at this point in the history
…e read operation timed out (#1182)
  • Loading branch information
seratch committed Feb 19, 2022
1 parent 9853614 commit 814da3c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions slack_sdk/socket_mode/builtin/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,15 @@ def connect(self) -> None:
raise

except Exception as e:
self.logger.exception(
f"Failed to establish a connection (session id: {self.session_id}, error: {e})"
)
error_message = f"Failed to establish a connection (session id: {self.session_id}, error: {e})"
if self.trace_enabled:
self.logger.exception(error_message)
else:
self.logger.error(error_message)

if self.on_error_listener is not None:
self.on_error_listener(e)

self.disconnect()

def disconnect(self) -> None:
Expand Down

0 comments on commit 814da3c

Please sign in to comment.