1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
class WebDavException(Exception):
pass
class NotValid(WebDavException):
pass
class OptionNotValid(NotValid):
def __init__(self, name, value, ns=""):
self.name = name
self.value = value
self.ns = ns
def __str__(self):
return "Option ({ns}{name}={value}) have invalid name or value".format(ns=self.ns, name=self.name,
value=self.value)
class CertificateNotValid(NotValid):
pass
class NotFound(WebDavException):
pass
class LocalResourceNotFound(NotFound):
def __init__(self, path):
self.path = path
def __str__(self):
return "Local file: {path} not found".format(path=self.path)
class RemoteResourceNotFound(NotFound):
def __init__(self, path):
self.path = path
def __str__(self):
return "Remote resource: {path} not found".format(path=self.path)
class RemoteParentNotFound(NotFound):
def __init__(self, path):
self.path = path
def __str__(self):
return "Remote parent for: {path} not found".format(path=self.path)
class MethodNotSupported(WebDavException):
def __init__(self, name, server):
self.name = name
self.server = server
def __str__(self):
return "Method '{name}' not supported for {server}".format(name=self.name, server=self.server)
class ConnectionException(WebDavException):
def __init__(self, exception):
self.exception = exception
def __str__(self):
return self.exception.__str__()
class NoConnection(WebDavException):
def __init__(self, hostname):
self.hostname = hostname
def __str__(self):
return "No connection with {hostname}".format(hostname=self.hostname)
# This exception left only for supporting original library interface.
class NotConnection(WebDavException):
def __init__(self, hostname):
self.hostname = hostname
def __str__(self):
return "No connection with {hostname}".format(hostname=self.hostname)
class ResponseErrorCode(WebDavException):
def __init__(self, url, code, message):
self.url = url
self.code = code
self.message = message
def __str__(self):
return "Request to {url} failed with code {code} and message: {message}".format(url=self.url, code=self.code,
message=self.message)
class NotEnoughSpace(WebDavException):
def __init__(self):
self.message = "Not enough space on the server"
def __str__(self):
return self.message
|