From 5de92e57d3bdabc65c111ccf52cc68ac7523a8a0 Mon Sep 17 00:00:00 2001 From: Magicbook1108 Date: Tue, 24 Feb 2026 19:15:20 +0800 Subject: [PATCH] Fix: 'None None' in log (#13192) ### What problem does this PR solve? Fix: 'None None' in log ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/utils/api_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/utils/api_utils.py b/api/utils/api_utils.py index 326fb62bc..9849a5c0e 100644 --- a/api/utils/api_utils.py +++ b/api/utils/api_utils.py @@ -20,6 +20,7 @@ import inspect import json import logging import os +import sys import time from copy import deepcopy from functools import wraps @@ -118,7 +119,10 @@ def serialize_for_json(obj): def get_data_error_result(code=RetCode.DATA_ERROR, message="Sorry! Data missing!"): - logging.exception(Exception(message)) + if sys.exc_info()[0] is not None: + logging.exception(message) + else: + logging.error(message) result_dict = {"code": code, "message": message} response = {} for key, value in result_dict.items():