Skip to content

Commit

Permalink
network: add errno printing on exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Apr 6, 2022
1 parent 9efd83e commit 689acc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rpcclient/rpcclient/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def send(self, buf: bytes, size: int = None) -> int:
if n < 0:
if self._client.errno == EPIPE:
self.deallocate()
raise BadReturnValueError(f'failed to send on fd: {self.fd}')
raise BadReturnValueError(f'failed to send on fd: {self.fd} ({self._client.last_error})')
return n

def sendall(self, buf: bytes):
Expand Down Expand Up @@ -118,7 +118,7 @@ def socket(self, family=AF_INET, type=SOCK_STREAM, proto=0) -> int:
""" socket(family, type, proto) at remote. read man for more details. """
result = self._client.symbols.socket(family, type, proto).c_int64
if 0 == result:
raise BadReturnValueError(f'failed to create socket: {result}')
raise BadReturnValueError(f'failed to create socket: {result} ({self._client.last_error})')
return result

def tcp_connect(self, address: str, port: int) -> Socket:
Expand Down

0 comments on commit 689acc7

Please sign in to comment.