def handle_urllib2_error(url, e):
if e.errno == errno.EINPROGRESS or '[Errno 115]' in str(e):
raise Exception(
'could not access: %s: operation timed out before completion '
'(raise the timeout value?)' % url
)
elif isinstance(e, HTTPError):
if e.getcode() == 403:
raise Exception(
"Host '%s' \n"
"requires authentication, please add to jenkins.json\n"
"format example:\n"
"'auth' : {\n"
"\t 'http://hostname' : {\n"
"\t\t'method' : 'basic',\n"
"\t\t'user' : 'username',\n"
"\t\t'password' : 'pass'},\n"
"\t 'http://hostname2...' : {'method' : None}\n"
"}"
% e.geturl()
)
elif e.getcode() == 401:
raise Exception(
"Invalid authentication to '%s', please update jenkins.json.\n"
"Note that this will happen with invalid credentials "
"even if the host doesn't require authentication for access."
% e.geturl()
)
raise Exception('could not access %s: %s' % (url, e))
评论列表
文章目录