commit
f8e6aeedd1
|
@ -10,7 +10,6 @@ import logging
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from django.db.models import ProtectedError
|
from django.db.models import ProtectedError
|
||||||
from rest_framework import exceptions
|
|
||||||
from rest_framework.exceptions import APIException as DRFAPIException, AuthenticationFailed
|
from rest_framework.exceptions import APIException as DRFAPIException, AuthenticationFailed
|
||||||
from rest_framework.views import set_rollback
|
from rest_framework.views import set_rollback
|
||||||
|
|
||||||
|
@ -37,9 +36,6 @@ def CustomExceptionHandler(ex, context):
|
||||||
elif isinstance(ex, DRFAPIException):
|
elif isinstance(ex, DRFAPIException):
|
||||||
set_rollback()
|
set_rollback()
|
||||||
msg = ex.detail
|
msg = ex.detail
|
||||||
elif isinstance(ex, exceptions.APIException):
|
|
||||||
set_rollback()
|
|
||||||
msg = ex.detail
|
|
||||||
elif isinstance(ex, ProtectedError):
|
elif isinstance(ex, ProtectedError):
|
||||||
set_rollback()
|
set_rollback()
|
||||||
msg = "删除失败:该条数据与其他数据有相关绑定"
|
msg = "删除失败:该条数据与其他数据有相关绑定"
|
||||||
|
|
Loading…
Reference in New Issue