1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

made URLError readable, instead of a bogus stack-trace.

added full_url, to even give a hint about the cause.
This commit is contained in:
Juergen Weigert 2010-03-07 21:56:29 +01:00
parent d6968933ee
commit f25bfa6ad1
2 changed files with 4 additions and 3 deletions

View File

@ -108,7 +108,7 @@ def run(prg):
return 1 return 1
except URLError, e: except URLError, e:
print >>sys.stderr, 'Failed to reach a server:', e.reason print >>sys.stderr, 'Failed to reach a server:\n', e.reason
return 1 return 1
except (oscerr.ConfigError, oscerr.NoConfigfile), e: except (oscerr.ConfigError, oscerr.NoConfigfile), e:

View File

@ -172,7 +172,7 @@ class myHTTPSHandler(M2Crypto.m2urllib2.HTTPSHandler):
def https_open(self, req): def https_open(self, req):
host = req.get_host() host = req.get_host()
if not host: if not host:
raise URLError('no host given') raise M2Crypto.m2urllib2.URLError('no host given: ' + req.get_full_url())
# Our change: Check to see if we're using a proxy. # Our change: Check to see if we're using a proxy.
# Then create an appropriate ssl-aware connection. # Then create an appropriate ssl-aware connection.
@ -199,7 +199,8 @@ class myHTTPSHandler(M2Crypto.m2urllib2.HTTPSHandler):
h.request(req.get_method(), req.get_full_url(), req.data, headers) h.request(req.get_method(), req.get_full_url(), req.data, headers)
r = h.getresponse() r = h.getresponse()
except socket.error, err: # XXX what error? except socket.error, err: # XXX what error?
raise URLError(err) err.filename = full_url
raise M2Crypto.m2urllib2.URLError(err)
# Pick apart the HTTPResponse object to get the addinfourl # Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly. # object initialized properly.