Simplified exception translation

This is enabled by server side modification that the fault middleware is
encoding error code into the error body.
This commit is contained in:
tengqm
2015-01-26 19:39:01 +08:00
parent f8a0f40258
commit 787dd54695

View File

@@ -232,15 +232,9 @@ def parse_exception(exc):
try:
code = record['error']['code']
except KeyError as err:
# Some exception are not caught by SDK, we need to try again
# The 'code' field may be misplaced
try:
code = record['code']
record['error']['code'] = code
except KeyError as err:
print(_('Malformed exception record, missing field "%s"') % err)
print(_('Original error record: %s') % record)
return
print(_('Malformed exception record, missing field "%s"') % err)
print(_('Original error record: %s') % record)
return
if code in _EXCEPTION_MAP:
inst = _EXCEPTION_MAP.get(code)