From 08a5faee7963705bb670f7fa5c368a0ab8e537f8 Mon Sep 17 00:00:00 2001 From: idss-haitun <9288407+idss-haitun@user.noreply.gitee.com> Date: Wed, 27 Jul 2022 07:24:51 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=87=8D=E5=A4=8D=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20DRFAPIException=E5=92=8Cexceptions.APIException?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E6=98=AF=E5=90=8C=E4=B8=80=E4=B8=AA=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=EF=BC=8C=E5=A6=82=E6=9E=9C=E8=BF=99=E9=87=8C=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E5=88=A4=E6=96=AD=E6=98=AF=E6=9C=89=E5=8E=9F=E5=9B=A0?= =?UTF-8?q?=E7=9A=84=EF=BC=8C=E8=AF=B7=E5=BF=BD=E7=95=A5=E6=9C=AC=E6=AC=A1?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/dvadmin/utils/exception.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/backend/dvadmin/utils/exception.py b/backend/dvadmin/utils/exception.py index 122e156..b9d2d51 100644 --- a/backend/dvadmin/utils/exception.py +++ b/backend/dvadmin/utils/exception.py @@ -10,7 +10,6 @@ import logging import traceback from django.db.models import ProtectedError -from rest_framework import exceptions from rest_framework.exceptions import APIException as DRFAPIException, AuthenticationFailed from rest_framework.views import set_rollback @@ -37,9 +36,6 @@ def CustomExceptionHandler(ex, context): elif isinstance(ex, DRFAPIException): set_rollback() msg = ex.detail - elif isinstance(ex, exceptions.APIException): - set_rollback() - msg = ex.detail elif isinstance(ex, ProtectedError): set_rollback() msg = "删除失败:该条数据与其他数据有相关绑定"