mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
pycriu: better socket error handling
[Errno 2] No such file or directory -> Socket file not found. [Errno 111] Connection refused -> Service not running. Signed-off-by: Andrii Herheliuk <andrii@herheliuk.com>
This commit is contained in:
parent
7aad7317b4
commit
d2c46b92b0
1 changed files with 8 additions and 1 deletions
|
|
@ -45,7 +45,14 @@ class _criu_comm_sk(_criu_comm):
|
|||
|
||||
def connect(self, daemon):
|
||||
self.sk = socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET)
|
||||
self.sk.connect(self.comm)
|
||||
try:
|
||||
self.sk.connect(self.comm)
|
||||
|
||||
except FileNotFoundError:
|
||||
raise FileNotFoundError("Socket file not found.")
|
||||
|
||||
except ConnectionRefusedError:
|
||||
raise ConnectionRefusedError("Service not running.")
|
||||
|
||||
return self.sk
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue