mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 08:59:54 +03:00
Add code to exception response
This commit is contained in:
parent
d7a151a71f
commit
13c379c189
|
@ -93,7 +93,7 @@ def exception_handler(exc, context):
|
|||
if isinstance(exc.detail, (list, dict)):
|
||||
data = exc.detail
|
||||
else:
|
||||
data = {'detail': exc.detail}
|
||||
data = {'detail': exc.detail, 'code': exc.detail.code}
|
||||
|
||||
set_rollback()
|
||||
return Response(data, status=exc.status_code, headers=headers)
|
||||
|
|
Loading…
Reference in New Issue
Block a user