diff options
author | Mark Hatle <mark.hatle@kernel.crashing.org> | 2023-03-09 16:52:21 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-11 20:49:19 +0000 |
commit | b29f6e04091b6bfe697dc41c76880de466736fc3 (patch) | |
tree | 6f22c49fe2d5bb1385f0992be96a1c4248e5c31d | |
parent | 6041b34740deee09ea65d705702555456a5e05d8 (diff) | |
download | bitbake-contrib-b29f6e04091b6bfe697dc41c76880de466736fc3.tar.gz |
wget.py: Combine urlopener exceptions
No reason to have three identical exception handles, refactor to catch any
of the exceptions with the same block of code.
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r-- | lib/bb/fetch2/wget.py | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py index 927487a0b..dc8831761 100644 --- a/lib/bb/fetch2/wget.py +++ b/lib/bb/fetch2/wget.py @@ -369,7 +369,7 @@ class Wget(FetchMethod): with opener.open(r, timeout=30) as response: pass - except urllib.error.URLError as e: + except (urllib.error.URLError, ConnectionResetError, TimeoutError) as e: if try_again: logger.debug2("checkstatus: trying again") return self.checkstatus(fetch, ud, d, False) @@ -377,22 +377,6 @@ class Wget(FetchMethod): # debug for now to avoid spamming the logs in e.g. remote sstate searches logger.debug2("checkstatus() urlopen failed: %s" % e) return False - except ConnectionResetError as e: - if try_again: - logger.debug2("checkstatus: trying again") - return self.checkstatus(fetch, ud, d, False) - else: - # debug for now to avoid spamming the logs in e.g. remote sstate searches - logger.debug2("checkstatus() urlopen failed: %s" % e) - return False - except TimeoutError as e: - if try_again: - logger.debug2("checkstatus: trying again") - return self.checkstatus(fetch, ud, d, False) - else: - # debug for now to avoid spamming the logs in e.g. remote sstate searches - logger.debug2("checkstatus() urlopen TimeoutError: %s" % e) - return False return True |