def custom_exception_handler(exc, context):
# Call REST framework's default exception handler first,
# to get the standard error response.
response = exception_handler(exc, context)
# Now add the HTTP status code to the response.
if response is not None:
response.data['status_code'] = response.status_code
return response
custom_exceptions.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录