From f29a1c29662f61c9dd26ef2c6c96b8fbb2eb7bd9 Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Thu, 9 Mar 2023 16:52:21 -0600 Subject: bitbake: 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. (Bitbake rev: b29f6e04091b6bfe697dc41c76880de466736fc3) Signed-off-by: Mark Hatle Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/wget.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'bitbake/lib/bb/fetch2/wget.py') diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 927487a0b6..dc88317610 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/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 -- cgit v1.2.3-54-g00ecf