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

Unified Diff: third_party/gsutil/boto/boto/exception.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 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 | « third_party/gsutil/boto/boto/emr/step.py ('k') | third_party/gsutil/boto/boto/file/README » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/gsutil/boto/boto/exception.py
diff --git a/third_party/gsutil/20110627/boto/boto/exception.py b/third_party/gsutil/boto/boto/exception.py
similarity index 89%
rename from third_party/gsutil/20110627/boto/boto/exception.py
rename to third_party/gsutil/boto/boto/exception.py
index f84c250de86f5b8867ca9e3a7a6a75f6476137ad..d28dc95010538d95f1c3aaeb5ac19935994df552 100644
--- a/third_party/gsutil/20110627/boto/boto/exception.py
+++ b/third_party/gsutil/boto/boto/exception.py
@@ -85,12 +85,13 @@ class BotoServerError(StandardError):
try:
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()
+ except (TypeError, xml.sax.SAXParseException), pe:
+ # 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':
@@ -297,6 +298,30 @@ class EC2ResponseError(BotoServerError):
for p in ('errors'):
setattr(self, p, None)
+class DynamoDBResponseError(BotoServerError):
+ """
+ This exception expects the fully parsed and decoded JSON response
+ body to be passed as the body parameter.
+
+ :ivar status: The HTTP status code.
+ :ivar reason: The HTTP reason message.
+ :ivar body: The Python dict that represents the decoded JSON
+ response body.
+ :ivar error_message: The full description of the AWS error encountered.
+ :ivar error_code: A short string that identifies the AWS error
+ (e.g. ConditionalCheckFailedException)
+ """
+
+ def __init__(self, status, reason, body=None, *args):
+ self.status = status
+ self.reason = reason
+ self.body = body
+ if self.body:
+ self.error_message = self.body.get('message', None)
+ self.error_code = self.body.get('__type', None)
+ if self.error_code:
+ self.error_code = self.error_code.split('#')[-1]
+
class EmrResponseError(BotoServerError):
"""
Error in response from EMR
@@ -368,6 +393,13 @@ class InvalidAclError(Exception):
Exception.__init__(self, message)
self.message = message
+class InvalidCorsError(Exception):
+ """Exception raised when CORS XML is invalid."""
+
+ def __init__(self, message):
+ Exception.__init__(self, message)
+ self.message = message
+
class NoAuthHandlerFound(Exception):
"""Is raised when no auth handlers were found ready to authenticate."""
pass
« no previous file with comments | « third_party/gsutil/boto/boto/emr/step.py ('k') | third_party/gsutil/boto/boto/file/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698