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)
def __init__(self, path): msg = _("Could not write to %(filename)s", {"filename": util.stringify(path)}) NetworkError.__init__(self, _('Write error'), msg)
def __init__(self, path): NetworkError.__init__( self, _('File not found'), _('The file "%(path)s" doesn\'t exist', {"path": path}))
def __init__(self, path): NetworkError.__init__( self, _('Read error'), _('Error while reading from "%(path)s"', {"path": path}))
def __init__(self, url): NetworkError.__init__(self, _('Invalid URL'), _('"%(url)s" is not a valid URL', {"url": url}))
def __init__(self, host): NetworkError.__init__( self, _('Unknown Host'), _('The domainname "%(host)s" couldn\'t be found', {"host": host}))
def __init__(self, longDescription): NetworkError.__init__(self, _("HTTP error"), longDescription)
def __init__(self, path): NetworkError.__init__(self, _('Read error'), _('Error while reading from "%(path)s"', {"path": path}))
def __init__(self, path): NetworkError.__init__(self, _('File not found'), _('The file "%(path)s" doesn\'t exist', {"path": path}))
def __init__(self, host): NetworkError.__init__(self, _('Unknown Host'), _('The domainname "%(host)s" couldn\'t be found', {"host": host}))