Parcourir la source

调整异常自定义消息返回

yf_fyh il y a 3 ans
Parent
commit
d517d77f7c
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  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)