diff --git a/apps/utils/exceptions.py b/apps/utils/exceptions.py index 9fe64739..da5a6bc7 100755 --- a/apps/utils/exceptions.py +++ b/apps/utils/exceptions.py @@ -41,9 +41,12 @@ def custom_exception_hander(exc, context): set_rollback() data['request_id'] = request_id - return Response(data, status=exc.status_code, headers=headers) + status = exc.status_code + if status not in [401, 404]: + status = 400 + return Response(data, status=status, headers=headers) args = (request_id, traceback.format_exc()) myLogger.error(f"{args[0]}-{args[1]}") return Response(data={'err_code': 'server_error', - 'err_detail': traceback.format_exc(), + 'err_detail': '', 'err_msg': '服务器错误', 'request_id': request_id}, status=500)