Better error reporting when curl is not installed
If buck build was done on a system without curl installed a misleading error message would be printed out: error creating directory /home/user/.gerritcodereview/buck-cache However, the real error was that invocation of curl failed. Since it was an OSError it was handled with the wrong except block. Separate handling of the OSError for the folder creation and curl invocation. Change-Id: Ic7e7c2c2704ea4cbccff4689dffe17a436108395
This commit is contained in:
@@ -122,12 +122,17 @@ src_url = resolve_url(args.u, redirects)
|
||||
if not path.exists(cache_ent):
|
||||
try:
|
||||
safe_mkdirs(path.dirname(cache_ent))
|
||||
print('Download %s' % src_url, file=stderr)
|
||||
check_call(['curl', '--proxy-anyauth', '-sfo', cache_ent, src_url])
|
||||
except OSError as err:
|
||||
print('error creating directory %s: %s' %
|
||||
(path.dirname(cache_ent), err), file=stderr)
|
||||
exit(1)
|
||||
|
||||
print('Download %s' % src_url, file=stderr)
|
||||
try:
|
||||
check_call(['curl', '--proxy-anyauth', '-sfo', cache_ent, src_url])
|
||||
except OSError as err:
|
||||
print('could not invoke curl: %s\nis curl installed?' % err, file=stderr)
|
||||
exit(1)
|
||||
except CalledProcessError as err:
|
||||
print('error using curl: %s' % err, file=stderr)
|
||||
exit(1)
|
||||
|
||||
Reference in New Issue
Block a user