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 InvalidContainerName(Error):
60 """ 61 Raised for invalid storage container names. 62 """ 63 pass
64 65
66 -class InvalidObjectName(Error):
67 """ 68 Raised for invalid storage object names. 69 """ 70 pass
71 72
73 -class InvalidMetaName(Error):
74 """ 75 Raised for invalid metadata names. 76 """ 77 pass
78 79
80 -class InvalidMetaValue(Error):
81 """ 82 Raised for invalid metadata value. 83 """ 84 pass
85 86
87 -class InvalidUrl(Error):
88 """ 89 Not a valid url for use with this software. 90 """ 91 pass
92 93
94 -class InvalidObjectSize(Error):
95 """ 96 Not a valid storage_object size attribute. 97 """ 98 pass
99 100
101 -class IncompleteSend(Error):
102 """ 103 Raised when there is a insufficient amount of data to send. 104 """ 105 pass
106 107
108 -class ContainerNotPublic(Error):
109 """ 110 Raised when public features of a non-public container are accessed. 111 """ 112 pass
113 114
115 -class CDNNotEnabled(Error):
116 """ 117 CDN is not enabled for this account. 118 """ 119 pass
120 121
122 -class AuthenticationFailed(Error):
123 """ 124 Raised on a failure to authenticate. 125 """ 126 pass
127 128
129 -class AuthenticationError(Error):
130 """ 131 Raised when an unspecified authentication error has occurred. 132 """ 133 pass
134