Merge pull request #94 from haosenwang1018/fix/bare-excepts
fix: replace 9 bare excepts with except Exception
This commit is contained in:
@@ -210,7 +210,7 @@ class ImportExportService:
|
||||
if ch.expansion_plan:
|
||||
try:
|
||||
expansion_plan = json.loads(ch.expansion_plan) if isinstance(ch.expansion_plan, str) else ch.expansion_plan
|
||||
except:
|
||||
except Exception:
|
||||
expansion_plan = None
|
||||
|
||||
exported_chapters.append(ChapterExportData(
|
||||
@@ -243,7 +243,7 @@ class ImportExportService:
|
||||
if char.traits:
|
||||
try:
|
||||
traits = json.loads(char.traits) if isinstance(char.traits, str) else char.traits
|
||||
except:
|
||||
except Exception:
|
||||
traits = None
|
||||
|
||||
exported.append(CharacterExportData(
|
||||
@@ -1420,7 +1420,7 @@ class ImportExportService:
|
||||
if char.traits:
|
||||
try:
|
||||
traits = json.loads(char.traits) if isinstance(char.traits, str) else char.traits
|
||||
except:
|
||||
except Exception:
|
||||
traits = None
|
||||
|
||||
# 基础角色数据
|
||||
|
||||
@@ -31,7 +31,7 @@ def clean_json_response(text: str) -> str:
|
||||
json.loads(text)
|
||||
logger.debug(f"✅ 直接解析成功,无需清洗")
|
||||
return text
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 找到第一个 { 或 [
|
||||
|
||||
Reference in New Issue
Block a user