mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-28 16:56:33 +00:00
add ConnectionBrokenWithHint for BrokenPipeErrors and similar, see #7016
no traceback, but error message and specific exit code.
This commit is contained in:
parent
45815554ce
commit
43a20b052e
2 changed files with 12 additions and 1 deletions
|
@ -699,6 +699,8 @@ Errors
|
||||||
UnexpectedRPCDataFormatFromServer rc: 86 traceback: no
|
UnexpectedRPCDataFormatFromServer rc: 86 traceback: no
|
||||||
Got unexpected RPC data format from server:
|
Got unexpected RPC data format from server:
|
||||||
{}
|
{}
|
||||||
|
ConnectionBrokenWithHint rc: 87 traceback: no
|
||||||
|
Connection to remote host is broken. {}
|
||||||
|
|
||||||
IntegrityError rc: 90 traceback: yes
|
IntegrityError rc: 90 traceback: yes
|
||||||
Data integrity error: {}
|
Data integrity error: {}
|
||||||
|
|
|
@ -112,6 +112,12 @@ def __init__(self, data):
|
||||||
super().__init__(data)
|
super().__init__(data)
|
||||||
|
|
||||||
|
|
||||||
|
class ConnectionBrokenWithHint(Error):
|
||||||
|
"""Connection to remote host is broken. {}"""
|
||||||
|
|
||||||
|
exit_mcode = 87
|
||||||
|
|
||||||
|
|
||||||
# Protocol compatibility:
|
# Protocol compatibility:
|
||||||
# In general the server is responsible for rejecting too old clients and the client it responsible for rejecting
|
# In general the server is responsible for rejecting too old clients and the client it responsible for rejecting
|
||||||
# too old servers. This ensures that the knowledge what is compatible is always held by the newer component.
|
# too old servers. This ensures that the knowledge what is compatible is always held by the newer component.
|
||||||
|
@ -428,7 +434,10 @@ def write(self, fd, to_send):
|
||||||
self.ratelimit_last = time.monotonic()
|
self.ratelimit_last = time.monotonic()
|
||||||
if len(to_send) > self.ratelimit_quota:
|
if len(to_send) > self.ratelimit_quota:
|
||||||
to_send = to_send[: self.ratelimit_quota]
|
to_send = to_send[: self.ratelimit_quota]
|
||||||
written = os.write(fd, to_send)
|
try:
|
||||||
|
written = os.write(fd, to_send)
|
||||||
|
except BrokenPipeError:
|
||||||
|
raise ConnectionBrokenWithHint("Broken Pipe") from None
|
||||||
if self.ratelimit:
|
if self.ratelimit:
|
||||||
self.ratelimit_quota -= written
|
self.ratelimit_quota -= written
|
||||||
return written
|
return written
|
||||||
|
|
Loading…
Reference in a new issue