删除重复逻辑

DRFAPIException和exceptions.APIException应该是同一个对象,如果这里重复判断是有原因的,请忽略本次提交
pull/65/head
idss-haitun 2022-07-27 07:24:51 +00:00 committed by Gitee
parent f082e66814
commit 08a5faee79
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 0 additions and 4 deletions

View File

@ -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 = "删除失败:该条数据与其他数据有相关绑定"