fix: auto repair bugs #21, #20
All checks were successful
Build and Deploy Backend / build-and-deploy (push) Successful in 6m44s

This commit is contained in:
repair-agent 2026-02-24 14:31:05 +08:00
parent c96bef3515
commit 5fb71b99f9

View File

@ -6,7 +6,10 @@ import traceback
import threading
import requests
from rest_framework.views import exception_handler
from rest_framework.exceptions import AuthenticationFailed as DRFAuthenticationFailed
from rest_framework.exceptions import NotAuthenticated
from rest_framework import status
from rest_framework_simplejwt.exceptions import InvalidToken, AuthenticationFailed as JWTAuthenticationFailed
from utils.response import APIResponse
@ -136,8 +139,8 @@ class ErrorCode:
def custom_exception_handler(exc, context):
"""自定义异常处理器"""
# 上报到 Log Center (仅上报非业务异常)
if not isinstance(exc, BusinessException):
# 上报到 Log Center (排除业务异常和认证异常,这些是正常业务流程)
if not isinstance(exc, (BusinessException, DRFAuthenticationFailed, NotAuthenticated, InvalidToken, JWTAuthenticationFailed)):
report_to_log_center(exc, context)
# 处理业务异常