1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-01-01 12:45:34 +00:00

simplify handle_error

This commit is contained in:
Thomas Waldmann 2023-05-24 02:51:00 +02:00
parent 4b796a7337
commit 2331341b74
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -647,6 +647,9 @@ def pop_preload_msgid(chunkid):
return msgid
def handle_error(unpacked):
if "exception_class" not in unpacked:
return
error = unpacked["exception_class"]
args = unpacked["exception_args"]
@ -687,12 +690,10 @@ def handle_error(unpacked):
try:
unpacked = self.responses.pop(waiting_for[0])
waiting_for.pop(0)
if "exception_class" in unpacked:
handle_error(unpacked)
else:
yield unpacked[RESULT]
if not waiting_for and not calls:
return
handle_error(unpacked)
yield unpacked[RESULT]
if not waiting_for and not calls:
return
except KeyError:
break
if cmd == "async_responses":
@ -707,10 +708,8 @@ def handle_error(unpacked):
else:
return
else:
if "exception_class" in unpacked:
handle_error(unpacked)
else:
yield unpacked[RESULT]
handle_error(unpacked)
yield unpacked[RESULT]
if self.to_send or ((calls or self.preload_ids) and len(waiting_for) < MAX_INFLIGHT):
w_fds = [self.stdin_fd]
else: