fix: replace bare except handlers with specific exception types

This commit is contained in:
kigland
2026-03-06 23:05:02 +08:00
parent 3199168d3e
commit 848f35f5df
7 changed files with 7 additions and 7 deletions

View File

@@ -209,7 +209,7 @@ class AWSBedrockLLMAdapter(BaseLLMAdapter[AWSBedrockLLMInvocationParams]):
tool_result_content = [{"json": content_json}]
else:
tool_result_content = [{"text": message["content"]}]
except:
except (json.JSONDecodeError, ValueError):
tool_result_content = [{"text": message["content"]}]
return {

View File

@@ -198,7 +198,7 @@ class TelnyxFrameSerializer(FrameSerializer):
f"Telnyx call {call_control_id} was already terminated"
)
return
except:
except Exception:
pass # Fall through to log the raw error
# Log other 422 errors

View File

@@ -212,7 +212,7 @@ class TwilioFrameSerializer(FrameSerializer):
if error_data.get("code") == 20404:
logger.debug(f"Twilio call {call_sid} was already terminated")
return
except:
except Exception:
pass # Fall through to log the raw error
# Log other 404 errors

View File

@@ -369,7 +369,7 @@ class AWSBedrockLLMContext(OpenAILLMContext):
tool_result_content = [{"json": content_json}]
else:
tool_result_content = [{"text": message["content"]}]
except:
except (json.JSONDecodeError, ValueError):
tool_result_content = [{"text": message["content"]}]
return {

View File

@@ -298,7 +298,7 @@ class MCPClient(BaseObject):
try:
logger.debug(f"Found {len(available_tools)} available tools")
except:
except Exception:
pass
for tool in available_tools.tools: