parent
73f63f2163
commit
7ebec2b114
2 changed files with 11 additions and 0 deletions
@ -0,0 +1,10 @@ |
|||||||
|
from rest_framework.views import exception_handler as base_exception_handler |
||||||
|
|
||||||
|
|
||||||
|
def exception_handler(exc, context): |
||||||
|
response = base_exception_handler(exc, context) |
||||||
|
if response is not None: |
||||||
|
response.data['status_code'] = response.status_code |
||||||
|
if 'detail' in response.data: |
||||||
|
response.data['error'] = response.data['detail'] |
||||||
|
return response |
||||||
Loading…
Reference in new issue