mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-07 07:02:53 +03:00
getdeps: introduce TransientFailure exception type
Summary: The goal is to return an error code > 127 in the case of a transient, retryable, infrastructure error. This diff generates those in the case of failure in downloading a URL or from interacting with LFS. Reviewed By: strager Differential Revision: D15266838 fbshipit-source-id: 4f52a791320123968869032c37912dded464a86e
This commit is contained in:
committed by
Facebook Github Bot
parent
b1883448e3
commit
b96314bea8
@@ -21,6 +21,7 @@ import zipfile
|
||||
|
||||
from .copytree import prefetch_dir_if_eden
|
||||
from .envfuncs import Env
|
||||
from .errors import TransientFailure
|
||||
from .platform import is_windows
|
||||
from .runcmd import run_cmd
|
||||
|
||||
@@ -548,7 +549,13 @@ def download_url_to_file_with_progress(url, file_name):
|
||||
|
||||
progress = Progress()
|
||||
start = time.time()
|
||||
(_filename, headers) = urlretrieve(url, file_name, reporthook=progress.progress)
|
||||
try:
|
||||
(_filename, headers) = urlretrieve(url, file_name, reporthook=progress.progress)
|
||||
except OSError as exc:
|
||||
raise TransientFailure(
|
||||
"Failed to download %s to %s: %s" % (url, file_name, str(exc))
|
||||
)
|
||||
|
||||
end = time.time()
|
||||
sys.stdout.write(" [Complete in %f seconds]\n" % (end - start))
|
||||
sys.stdout.flush()
|
||||
|
Reference in New Issue
Block a user