/
errors.py
112 lines (91 loc) · 2.24 KB
/
errors.py
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
103
104
105
106
107
108
109
110
111
"""
exception classes
See COPYING for license information.
"""
class ResponseError(Exception):
"""
Raised when the remote service returns an error.
"""
def __init__(self, status, reason):
self.status = status
self.reason = reason
Exception.__init__(self)
def __str__(self):
return '%d: %s' % (self.status, self.reason)
def __repr__(self):
return '%d: %s' % (self.status, self.reason)
class NoSuchContainer(Exception):
"""
Raised on a non-existent Container.
"""
pass
class NoSuchObject(Exception):
"""
Raised on a non-existent Object.
"""
pass
class ContainerNotEmpty(Exception):
"""
Raised when attempting to delete a Container that still contains Objects.
"""
def __init__(self, container_name):
self.container_name = container_name
def __str__(self):
return "Cannot delete non-empty Container %s" % self.container_name
def __repr__(self):
return "%s(%s)" % (self.__class__.__name__, self.container_name)
class InvalidContainerName(Exception):
"""
Raised for invalid storage container names.
"""
pass
class InvalidObjectName(Exception):
"""
Raised for invalid storage object names.
"""
pass
class InvalidMetaName(Exception):
"""
Raised for invalid metadata names.
"""
pass
class InvalidMetaValue(Exception):
"""
Raised for invalid metadata value.
"""
pass
class InvalidUrl(Exception):
"""
Not a valid url for use with this software.
"""
pass
class InvalidObjectSize(Exception):
"""
Not a valid storage_object size attribute.
"""
pass
class IncompleteSend(Exception):
"""
Raised when there is a insufficient amount of data to send.
"""
pass
class ContainerNotPublic(Exception):
"""
Raised when public features of a non-public container are accessed.
"""
pass
class CDNNotEnabled(Exception):
"""
CDN is not enabled for this account.
"""
pass
class AuthenticationFailed(Exception):
"""
Raised on a failure to authenticate.
"""
pass
class AuthenticationError(Exception):
"""
Raised when an unspecified authentication error has occurred.
"""
pass