summaryrefslogtreecommitdiff
path: root/boto/exception.py
diff options
context:
space:
mode:
Diffstat (limited to 'boto/exception.py')
-rw-r--r--boto/exception.py33
1 files changed, 24 insertions, 9 deletions
diff --git a/boto/exception.py b/boto/exception.py
index 9baa0999..36c226fa 100644
--- a/boto/exception.py
+++ b/boto/exception.py
@@ -30,9 +30,10 @@ import xml.sax
import boto
from boto import handler
-from boto.compat import json, six, StandardError
+from boto.compat import json, StandardError
from boto.resultset import ResultSet
+
class BotoClientError(StandardError):
"""
General Boto Client error (error accessing AWS)
@@ -112,7 +113,7 @@ class BotoServerError(StandardError):
try:
h = handler.XmlHandlerWrapper(self, self)
h.parseString(self.body)
- except (TypeError, xml.sax.SAXParseException) as pe:
+ except (TypeError, xml.sax.SAXParseException):
# What if it's JSON? Let's try that.
try:
parsed = json.loads(self.body)
@@ -209,6 +210,7 @@ class StorageCreateError(BotoServerError):
else:
return super(StorageCreateError, self).endElement(name, value, connection)
+
class S3CreateError(StorageCreateError):
"""
Error creating a bucket or key on S3.
@@ -294,15 +296,15 @@ class StorageResponseError(BotoServerError):
super(StorageResponseError, self).__init__(status, reason, body)
def startElement(self, name, attrs, connection):
- return super(StorageResponseError, self).startElement(name, attrs,
- connection)
+ return super(StorageResponseError, self).startElement(
+ name, attrs, connection)
def endElement(self, name, value, connection):
if name == 'Resource':
self.resource = value
else:
- return super(StorageResponseError, self).endElement(name, value,
- connection)
+ return super(StorageResponseError, self).endElement(
+ name, value, connection)
def _cleanupParsedProperties(self):
super(StorageResponseError, self)._cleanupParsedProperties()
@@ -332,8 +334,8 @@ class EC2ResponseError(BotoServerError):
self.errors = None
self._errorResultSet = []
super(EC2ResponseError, self).__init__(status, reason, body)
- self.errors = [ (e.error_code, e.error_message) \
- for e in self._errorResultSet ]
+ self.errors = [
+ (e.error_code, e.error_message) for e in self._errorResultSet]
if len(self.errors):
self.error_code, self.error_message = self.errors[0]
@@ -348,7 +350,7 @@ class EC2ResponseError(BotoServerError):
if name == 'RequestID':
self.request_id = value
else:
- return None # don't call subclass here
+ return None # don't call subclass here
def _cleanupParsedProperties(self):
super(EC2ResponseError, self)._cleanupParsedProperties()
@@ -420,30 +422,35 @@ class SDBResponseError(BotoServerError):
"""
pass
+
class AWSConnectionError(BotoClientError):
"""
General error connecting to Amazon Web Services.
"""
pass
+
class StorageDataError(BotoClientError):
"""
Error receiving data from a storage service.
"""
pass
+
class S3DataError(StorageDataError):
"""
Error receiving data from S3.
"""
pass
+
class GSDataError(StorageDataError):
"""
Error receiving data from GS.
"""
pass
+
class InvalidUriError(Exception):
"""Exception raised when URI is invalid."""
@@ -451,6 +458,7 @@ class InvalidUriError(Exception):
super(InvalidUriError, self).__init__(message)
self.message = message
+
class InvalidAclError(Exception):
"""Exception raised when ACL XML is invalid."""
@@ -458,6 +466,7 @@ class InvalidAclError(Exception):
super(InvalidAclError, self).__init__(message)
self.message = message
+
class InvalidCorsError(Exception):
"""Exception raised when CORS XML is invalid."""
@@ -465,10 +474,12 @@ class InvalidCorsError(Exception):
super(InvalidCorsError, self).__init__(message)
self.message = message
+
class NoAuthHandlerFound(Exception):
"""Is raised when no auth handlers were found ready to authenticate."""
pass
+
class InvalidLifecycleConfigError(Exception):
"""Exception raised when GCS lifecycle configuration XML is invalid."""
@@ -476,6 +487,7 @@ class InvalidLifecycleConfigError(Exception):
super(InvalidLifecycleConfigError, self).__init__(message)
self.message = message
+
# Enum class for resumable upload failure disposition.
class ResumableTransferDisposition(object):
# START_OVER means an attempt to resume an existing transfer failed,
@@ -500,6 +512,7 @@ class ResumableTransferDisposition(object):
# upload ID.
ABORT = 'ABORT'
+
class ResumableUploadException(Exception):
"""
Exception raised for various resumable upload problems.
@@ -516,6 +529,7 @@ class ResumableUploadException(Exception):
return 'ResumableUploadException("%s", %s)' % (
self.message, self.disposition)
+
class ResumableDownloadException(Exception):
"""
Exception raised for various resumable download problems.
@@ -532,6 +546,7 @@ class ResumableDownloadException(Exception):
return 'ResumableDownloadException("%s", %s)' % (
self.message, self.disposition)
+
class TooManyRecordsException(Exception):
"""
Exception raised when a search of Route53 records returns more