Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: boto/exception.py

Issue 8386013: Merging in latest boto. (Closed) Base URL: svn://svn.chromium.org/boto
Patch Set: Redoing vendor drop by deleting and then merging. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « boto/emr/step.py ('k') | boto/file/bucket.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: boto/exception.py
diff --git a/boto/exception.py b/boto/exception.py
index 718be46f9c9ff3d48621f456b0ca46e459c1a7bd..bfdb052a73a6a7d20c3b62665c986a8568075ebd 100644
--- a/boto/exception.py
+++ b/boto/exception.py
@@ -35,8 +35,8 @@ class BotoClientError(StandardError):
General Boto Client error (error accessing AWS)
"""
- def __init__(self, reason):
- StandardError.__init__(self)
+ def __init__(self, reason, *args):
+ StandardError.__init__(self, reason, *args)
self.reason = reason
def __repr__(self):
@@ -69,8 +69,8 @@ class GSPermissionsError(StoragePermissionsError):
class BotoServerError(StandardError):
- def __init__(self, status, reason, body=None):
- StandardError.__init__(self)
+ def __init__(self, status, reason, body=None, *args):
+ StandardError.__init__(self, status, reason, body, *args)
self.status = status
self.reason = reason
self.body = body or ''
@@ -86,11 +86,12 @@ class BotoServerError(StandardError):
h = handler.XmlHandler(self, self)
xml.sax.parseString(self.body, h)
except xml.sax.SAXParseException, pe:
- # Go ahead and clean up anything that may have
- # managed to get into the error data so we
- # don't get partial garbage.
- print "Warning: failed to parse error message from AWS: %s" % pe
- self._cleanupParsedProperties()
+ # Remove unparsable message body so we don't include garbage
+ # in exception. But first, save self.body in self.error_message
+ # because occasionally we get error messages from Eucalyptus
+ # that are just text strings that we want to preserve.
+ self.error_message = self.body
+ self.body = None
def __getattr__(self, name):
if name == 'message':
@@ -221,7 +222,7 @@ class SQSDecodeError(BotoClientError):
Error when decoding an SQS message.
"""
def __init__(self, reason, message):
- BotoClientError.__init__(self, reason)
+ BotoClientError.__init__(self, reason, message)
self.message = message
def __repr__(self):
@@ -358,14 +359,14 @@ class InvalidUriError(Exception):
"""Exception raised when URI is invalid."""
def __init__(self, message):
- Exception.__init__(self)
+ Exception.__init__(self, message)
self.message = message
class InvalidAclError(Exception):
"""Exception raised when ACL XML is invalid."""
def __init__(self, message):
- Exception.__init__(self)
+ Exception.__init__(self, message)
self.message = message
class NoAuthHandlerFound(Exception):
@@ -390,11 +391,21 @@ class ResumableTransferDisposition(object):
START_OVER = 'START_OVER'
# WAIT_BEFORE_RETRY means the resumable transfer failed but that it can
- # be retried after a time delay.
+ # be retried after a time delay within the current process.
WAIT_BEFORE_RETRY = 'WAIT_BEFORE_RETRY'
- # ABORT means the resumable transfer failed and that delaying/retrying
- # within the current process will not help.
+ # ABORT_CUR_PROCESS means the resumable transfer failed and that
+ # delaying/retrying within the current process will not help. If
+ # resumable transfer included a state tracker file the upload can be
+ # retried again later, in another process (e.g., a later run of gsutil).
+ ABORT_CUR_PROCESS = 'ABORT_CUR_PROCESS'
+
+ # ABORT means the resumable transfer failed in a way that it does not
+ # make sense to continue in the current process, and further that the
+ # current tracker ID should not be preserved (in a tracker file if one
+ # was specified at resumable upload start time). If the user tries again
+ # later (e.g., a separate run of gsutil) it will get a new resumable
+ # upload ID.
ABORT = 'ABORT'
class ResumableUploadException(Exception):
@@ -405,7 +416,7 @@ class ResumableUploadException(Exception):
"""
def __init__(self, message, disposition):
- Exception.__init__(self)
+ Exception.__init__(self, message, disposition)
self.message = message
self.disposition = disposition
@@ -421,7 +432,7 @@ class ResumableDownloadException(Exception):
"""
def __init__(self, message, disposition):
- Exception.__init__(self)
+ Exception.__init__(self, message, disposition)
self.message = message
self.disposition = disposition
« no previous file with comments | « boto/emr/step.py ('k') | boto/file/bucket.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698