Add check if exc.detail is instance of tuple

This commit is contained in:
jun0jang 2019-11-06 16:13:01 +09:00
parent 13c379c189
commit d1ebf825c6

View File

@ -90,7 +90,7 @@ def exception_handler(exc, context):
if getattr(exc, 'wait', None): if getattr(exc, 'wait', None):
headers['Retry-After'] = '%d' % exc.wait headers['Retry-After'] = '%d' % exc.wait
if isinstance(exc.detail, (list, dict)): if isinstance(exc.detail, (list, tuple, dict)):
data = exc.detail data = exc.detail
else: else:
data = {'detail': exc.detail, 'code': exc.detail.code} data = {'detail': exc.detail, 'code': exc.detail.code}