Package cloudfiles :: Module errors
[frames] | no frames]

Source Code for Module cloudfiles.errors

  1  """ 
  2  exception classes 
  3   
  4  See COPYING for license information. 
  5  """ 
  6   
7 -class Error(StandardError):
8 """ 9 Base class for all errors and exceptions 10 """ 11 pass
12 13
14 -class ResponseError(Error):
15 """ 16 Raised when the remote service returns an error. 17 """
18 - def __init__(self, status, reason):
19 self.status = status 20 self.reason = reason 21 Error.__init__(self)
22
23 - def __str__(self):
24 return '%d: %s' % (self.status, self.reason)
25
26 - def __repr__(self):
27 return '%d: %s' % (self.status, self.reason)
28 29
30 -class NoSuchContainer(Error):
31 """ 32 Raised on a non-existent Container. 33 """ 34 pass
35 36
37 -class NoSuchObject(Error):
38 """ 39 Raised on a non-existent Object. 40 """ 41 pass
42 43
44 -class ContainerNotEmpty(Error):
45 """ 46 Raised when attempting to delete a Container that still contains Objects. 47 """
48 - def __init__(self, container_name):
49 self.container_name = container_name 50 Error.__init__(self)
51
52 - def __str__(self):
53 return "Cannot delete non-empty Container %s" % self.container_name
54
55 - def __repr__(self):
56 return "%s(%s)" % (self.__class__.__name__, self.container_name)
57 58
59 -class ContainerExists(Error):
60 """ 61 Raised when attempting to create a Container when the container already 62 exists. 63 """ 64 pass
65 66
67 -class InvalidContainerName(Error):
68 """ 69 Raised for invalid storage container names. 70 """ 71 pass
72 73
74 -class InvalidObjectName(Error):
75 """ 76 Raised for invalid storage object names. 77 """ 78 pass
79 80
81 -class InvalidMetaName(Error):
82 """ 83 Raised for invalid metadata names. 84 """ 85 pass
86 87
88 -class InvalidMetaValue(Error):
89 """ 90 Raised for invalid metadata value. 91 """ 92 pass
93 94
95 -class InvalidUrl(Error):
96 """ 97 Not a valid url for use with this software. 98 """ 99 pass
100 101
102 -class InvalidObjectSize(Error):
103 """ 104 Not a valid storage_object size attribute. 105 """ 106 pass
107 108
109 -class IncompleteSend(Error):
110 """ 111 Raised when there is a insufficient amount of data to send. 112 """ 113 pass
114 115
116 -class ContainerNotPublic(Error):
117 """ 118 Raised when public features of a non-public container are accessed. 119 """ 120 pass
121 122
123 -class CDNNotEnabled(Error):
124 """ 125 CDN is not enabled for this account. 126 """ 127 pass
128 129
130 -class AuthenticationFailed(Error):
131 """ 132 Raised on a failure to authenticate. 133 """ 134 pass
135 136
137 -class AuthenticationError(Error):
138 """ 139 Raised when an unspecified authentication error has occurred. 140 """ 141 pass
142