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

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

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month 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/boto/boto/mws/connection.py ('k') | third_party/boto/boto/mws/response.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/boto/boto/mws/exception.py
===================================================================
--- third_party/boto/boto/mws/exception.py (revision 33376)
+++ third_party/boto/boto/mws/exception.py (working copy)
@@ -1,4 +1,4 @@
-# Copyright (c) 2012 Andy Davidoff http://www.disruptek.com/
+# Copyright (c) 2012-2014 Andy Davidoff http://www.disruptek.com/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -19,19 +19,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from boto.exception import BotoServerError
+from boto.mws.response import ResponseFactory
-class ResponseErrorFactory(BotoServerError):
+class ResponseErrorFactory(ResponseFactory):
- def __new__(cls, *args, **kw):
- error = BotoServerError(*args, **kw)
- try:
- newclass = globals()[error.error_code]
- except KeyError:
- newclass = ResponseError
- obj = newclass.__new__(newclass, *args, **kw)
- obj.__dict__.update(error.__dict__)
- return obj
+ def __call__(self, status, reason, body=None):
+ server = BotoServerError(status, reason, body=body)
+ supplied = self.find_element(server.error_code, '', ResponseError)
+ print supplied.__name__
+ return supplied(status, reason, body=body)
class ResponseError(BotoServerError):
@@ -41,16 +38,14 @@
retry = False
def __repr__(self):
- return '{0}({1}, {2},\n\t{3})'.format(self.__class__.__name__,
- self.status, self.reason,
- self.error_message)
+ return '{0.__name__}({1.reason}: "{1.message}")' \
+ .format(self.__class__, self)
def __str__(self):
- return 'MWS Response Error: {0.status} {0.__class__.__name__} {1}\n' \
- '{2}\n' \
- '{0.error_message}'.format(self,
- self.retry and '(Retriable)' or '',
- self.__doc__.strip())
+ doc = self.__doc__ and self.__doc__.strip() + "\n" or ''
+ return '{1.__name__}: {0.reason} {2}\n{3}' \
+ '{0.message}'.format(self, self.__class__,
+ self.retry and '(Retriable)' or '', doc)
class RetriableResponseError(ResponseError):
« no previous file with comments | « third_party/boto/boto/mws/connection.py ('k') | third_party/boto/boto/mws/response.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698