fix: replace bare except clauses with except Exception

Bare `except:` catches BaseException including KeyboardInterrupt and
SystemExit. Replaced 29 instances with `except Exception:`.
This commit is contained in:
haosenwang1018
2026-02-25 11:49:19 +00:00
parent 1a7a8c98d9
commit adca89b973
20 changed files with 29 additions and 29 deletions

View File

@@ -208,7 +208,7 @@ class ChatGPTBot(Bot, OpenAIImage, OpenAICompatibleBot):
try:
os.remove(image_path)
logger.debug(f"[CHATGPT] Removed temp image file: {image_path}")
except:
except Exception:
pass
return Reply(ReplyType.TEXT, content)

View File

@@ -383,7 +383,7 @@ class ClaudeAPIBot(Bot, OpenAIImage):
try:
error_data = json.loads(error_text)
error_msg = error_data.get("error", {}).get("message", error_text)
except:
except Exception:
error_msg = error_text or "Unknown error"
yield {

View File

@@ -347,7 +347,7 @@ class GoogleGeminiBot(Bot):
tool_result_data = json.loads(tool_content)
else:
tool_result_data = tool_content
except:
except Exception:
tool_result_data = {"result": tool_content}
# Find the tool name from previous messages

View File

@@ -608,7 +608,7 @@ def _handle_linkai_stream_response(self, base_url, headers, body):
try:
error_data = json.loads(error_text)
error_msg = error_data.get("error", {}).get("message", error_text)
except:
except Exception:
error_msg = error_text or "Unknown error"
yield {