mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 12:49:34 +02:00
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 <mark.hatle@kernel.crashing.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
f9b422152b
commit
f29a1c2966
@@ -369,7 +369,7 @@ class Wget(FetchMethod):
|
|||||||
|
|
||||||
with opener.open(r, timeout=30) as response:
|
with opener.open(r, timeout=30) as response:
|
||||||
pass
|
pass
|
||||||
except urllib.error.URLError as e:
|
except (urllib.error.URLError, ConnectionResetError, TimeoutError) as e:
|
||||||
if try_again:
|
if try_again:
|
||||||
logger.debug2("checkstatus: trying again")
|
logger.debug2("checkstatus: trying again")
|
||||||
return self.checkstatus(fetch, ud, d, False)
|
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
|
# debug for now to avoid spamming the logs in e.g. remote sstate searches
|
||||||
logger.debug2("checkstatus() urlopen failed: %s" % e)
|
logger.debug2("checkstatus() urlopen failed: %s" % e)
|
||||||
return False
|
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
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user