Exemple #1
0
 def on_error(self, code, handle):
     if code in (pycurl.E_URL_MALFORMAT, pycurl.E_UNSUPPORTED_PROTOCOL):
         error = MalformedURL(self.options.url)
     elif code == pycurl.E_COULDNT_CONNECT:
         error = ConnectionError(self.options.host)
     elif code == pycurl.E_PARTIAL_FILE:
         error = ServerClosedConnection(self.options.host)
     elif code == pycurl.E_GOT_NOTHING:
         error = EmptyResponse(self.options.host)
     elif code == pycurl.E_HTTP_RANGE_ERROR:
         error = ResumeFailed(self.options.host)
     elif code == pycurl.E_TOO_MANY_REDIRECTS:
         error = TooManyRedirects(self.options.url)
     elif code == pycurl.E_COULDNT_RESOLVE_HOST:
         error = UnknownHostError(self.options.host)
     elif code == pycurl.E_OPERATION_TIMEOUTED:
         error = ConnectionTimeout(self.options.host)
     elif (code == pycurl.E_RECV_ERROR
           and self.handle.getinfo(pycurl.HTTP_CONNECTCODE) == 407):
         # Hack for proxy authentication errors with HTTPS
         self.handle_proxy_auth()
         return
     else:
         logging.warn("Unknown network error.  Code: %s", code)
         errstr = handle.errstr()
         try:
             description = errstr.decode('utf-8')
         except UnicodeError, e:
             logging.warn("error converting errstr: %s (%r)", e, errstr)
             description = u'Unknown'
         error = NetworkError(_("Unknown"), description)
Exemple #2
0
 def __init__(self, path):
     msg = _("Could not write to %(filename)s",
             {"filename": util.stringify(path)})
     NetworkError.__init__(self, _('Write error'), msg)
Exemple #3
0
 def __init__(self, path):
     NetworkError.__init__(
         self, _('File not found'),
         _('The file "%(path)s" doesn\'t exist', {"path": path}))
Exemple #4
0
 def __init__(self, path):
     NetworkError.__init__(
         self, _('Read error'),
         _('Error while reading from "%(path)s"', {"path": path}))
Exemple #5
0
 def __init__(self, url):
     NetworkError.__init__(self, _('Invalid URL'),
                           _('"%(url)s" is not a valid URL', {"url": url}))
Exemple #6
0
 def __init__(self, host):
     NetworkError.__init__(
         self, _('Unknown Host'),
         _('The domainname "%(host)s" couldn\'t be found', {"host": host}))
Exemple #7
0
 def __init__(self, path):
     msg = _("Could not write to %(filename)s",
         {"filename": util.stringify(path)})
     NetworkError.__init__(self, _('Write error'), msg)
Exemple #8
0
 def __init__(self, longDescription):
     NetworkError.__init__(self, _("HTTP error"), longDescription)
Exemple #9
0
 def __init__(self, path):
     NetworkError.__init__(self, _('Read error'),
         _('Error while reading from "%(path)s"', {"path": path}))
Exemple #10
0
 def __init__(self, path):
     NetworkError.__init__(self, _('File not found'),
         _('The file "%(path)s" doesn\'t exist', {"path": path}))
Exemple #11
0
 def __init__(self, host):
     NetworkError.__init__(self, _('Unknown Host'),
         _('The domainname "%(host)s" couldn\'t be found', {"host": host}))
Exemple #12
0
 def __init__(self, url):
     NetworkError.__init__(self, _('Invalid URL'),
             _('"%(url)s" is not a valid URL', {"url": url}))
Exemple #13
0
 def __init__(self, longDescription):
     NetworkError.__init__(self, _("HTTP error"), longDescription)