From 88cec2c3966080fa79e5e623c7603c0eed4b94e3 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 27 Jun 2019 12:29:04 -0700 Subject: [PATCH] s3api: Put more information in the str() for InternalError There are few things more frustrating when digging through a log than finding a traceback that ends with raise InternalError('unexpected status code %d' % status) while having no indication of what the status code was. Change-Id: I08e9f7c0643ae0469bd1937a30c1c4477b67c31f --- swift/common/middleware/s3api/s3response.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/swift/common/middleware/s3api/s3response.py b/swift/common/middleware/s3api/s3response.py index a34465a3d2..07cfef1b04 100644 --- a/swift/common/middleware/s3api/s3response.py +++ b/swift/common/middleware/s3api/s3response.py @@ -361,6 +361,10 @@ class InternalError(ErrorResponse): _status = '500 Internal Server Error' _msg = 'We encountered an internal error. Please try again.' + def __str__(self): + return '%s: %s (%s)' % ( + self.__class__.__name__, self.status, self._msg) + class InvalidAccessKeyId(ErrorResponse): _status = '403 Forbidden'