You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

10 lines
376 B

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