Fix inner has no attribute 'message'

When DBDeadlock in karbor-api service, it get the following error:
AttributeError: 'DBDeadlock' object has no attribute 'message'.

This patch corrects that problem.

Change-Id: I1b268f5cca2c4efdcfb055d2fd8dfe522e6daf9d
Closes-Bug: #1891571
This commit is contained in:
wangyu 2020-08-14 10:17:28 +08:00
parent 0764f5dab1
commit e167485dd7
1 changed files with 3 additions and 1 deletions

View File

@ -39,7 +39,9 @@ class FaultWrapper(base_wsgi.Middleware):
status, webob.exc.HTTPInternalServerError)()
def _error(self, inner, req):
LOG.error('Middleware error occurred: %s', inner.message)
LOG.error('Middleware error occurred: %(type)s %(error)s',
{'type': type(inner),
'error': inner})
safe = getattr(inner, 'safe', False)
headers = getattr(inner, 'headers', None)
status = getattr(inner, 'code', http_client.INTERNAL_SERVER_ERROR)