Skip to content

Commit

Permalink
Raise OperationalError for socket timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
jiezhen-chen committed Aug 1, 2023
1 parent 5b94858 commit d4e11c3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion redshift_connector/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,10 @@ def get_calling_module() -> str:
self._usock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
except socket.error as e:
self._usock.close()
raise InterfaceError("communication error", e)
if socket.timeout:
raise OperationalError("connection time out", e)
else:
raise InterfaceError("communication error", e)
self._flush: typing.Callable = self._sock.flush
self._read: typing.Callable = self._sock.read
self._write: typing.Callable = self._sock.write
Expand Down

0 comments on commit d4e11c3

Please sign in to comment.