Replace 'faultstring' with 'title'
The field 'faultstring' is not used in Zun's exception. Let's replace it with 'title' instead. Change-Id: If181f7d5cb35b15986d83ad6363d0c80a1e5af06
This commit is contained in:
parent
80323e1ca6
commit
f89ebf5f1f
@ -110,13 +110,13 @@ class NoExceptionTracebackHook(hooks.PecanHook):
|
|||||||
if cfg.CONF.debug and json_body.get('faultcode') != 'Server':
|
if cfg.CONF.debug and json_body.get('faultcode') != 'Server':
|
||||||
return
|
return
|
||||||
|
|
||||||
faultsting = json_body.get('faultstring')
|
title = json_body.get('title')
|
||||||
traceback_marker = 'Traceback (most recent call last):'
|
traceback_marker = 'Traceback (most recent call last):'
|
||||||
if faultsting and (traceback_marker in faultsting):
|
if title and (traceback_marker in title):
|
||||||
# Cut-off traceback.
|
# Cut-off traceback.
|
||||||
faultsting = faultsting.split(traceback_marker, 1)[0]
|
title = title.split(traceback_marker, 1)[0]
|
||||||
# Remove trailing newlines and spaces if any.
|
# Remove trailing newlines and spaces if any.
|
||||||
json_body['faultstring'] = faultsting.rstrip()
|
json_body['title'] = title.rstrip()
|
||||||
# Replace the whole json. Cannot change original one beacause it's
|
# Replace the whole json. Cannot change original one beacause it's
|
||||||
# generated on the fly.
|
# generated on the fly.
|
||||||
state.response.json = json_body
|
state.response.json = json_body
|
||||||
|
@ -70,9 +70,6 @@ class ParsableErrorMiddleware(object):
|
|||||||
if 'title' in err and 'description' in err:
|
if 'title' in err and 'description' in err:
|
||||||
title = err['title']
|
title = err['title']
|
||||||
desc = err['description']
|
desc = err['description']
|
||||||
elif 'faultstring' in err:
|
|
||||||
title = err['faultstring'].split('.', 1)[0]
|
|
||||||
desc = err['faultstring']
|
|
||||||
else:
|
else:
|
||||||
title = ''
|
title = ''
|
||||||
desc = ''
|
desc = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user