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