소스 검색

调整异常自定义消息返回

yf_fyh 3 년 전
부모
커밋
d517d77f7c
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      utils/exception.py

+ 1 - 1
utils/exception.py

@@ -12,7 +12,7 @@ def custom_exception_handler(exc, context):
     response = exception_handler(exc, context)
     if response is None:
         return Response({
-            'code': response.status_code,
+            'code': status.HTTP_500_INTERNAL_SERVER_ERROR,
             'msg': 'error:{exc}'.format(exc=exc),
             'data': ''
         }, status=status.HTTP_500_INTERNAL_SERVER_ERROR, exception=True)