fix: replace bare except handlers with specific exception types
This commit is contained in:
@@ -70,7 +70,7 @@ class UrlToImageProcessor(FrameProcessor):
|
|||||||
return data["artObject"]["webImage"]["url"]
|
return data["artObject"]["webImage"]["url"]
|
||||||
if "artworks" in data and len(data["artworks"]):
|
if "artworks" in data and len(data["artworks"]):
|
||||||
return data["artworks"][0]["webImage"]["url"]
|
return data["artworks"][0]["webImage"]["url"]
|
||||||
except:
|
except (json.JSONDecodeError, KeyError, TypeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class UrlToImageProcessor(FrameProcessor):
|
|||||||
return data["artObject"]["webImage"]["url"]
|
return data["artObject"]["webImage"]["url"]
|
||||||
if "artworks" in data and len(data["artworks"]):
|
if "artworks" in data and len(data["artworks"]):
|
||||||
return data["artworks"][0]["webImage"]["url"]
|
return data["artworks"][0]["webImage"]["url"]
|
||||||
except:
|
except (json.JSONDecodeError, KeyError, TypeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def run_image_process(self, image_url: str):
|
async def run_image_process(self, image_url: str):
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class AWSBedrockLLMAdapter(BaseLLMAdapter[AWSBedrockLLMInvocationParams]):
|
|||||||
tool_result_content = [{"json": content_json}]
|
tool_result_content = [{"json": content_json}]
|
||||||
else:
|
else:
|
||||||
tool_result_content = [{"text": message["content"]}]
|
tool_result_content = [{"text": message["content"]}]
|
||||||
except:
|
except (json.JSONDecodeError, ValueError):
|
||||||
tool_result_content = [{"text": message["content"]}]
|
tool_result_content = [{"text": message["content"]}]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ class TelnyxFrameSerializer(FrameSerializer):
|
|||||||
f"Telnyx call {call_control_id} was already terminated"
|
f"Telnyx call {call_control_id} was already terminated"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
except:
|
except Exception:
|
||||||
pass # Fall through to log the raw error
|
pass # Fall through to log the raw error
|
||||||
|
|
||||||
# Log other 422 errors
|
# Log other 422 errors
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ class TwilioFrameSerializer(FrameSerializer):
|
|||||||
if error_data.get("code") == 20404:
|
if error_data.get("code") == 20404:
|
||||||
logger.debug(f"Twilio call {call_sid} was already terminated")
|
logger.debug(f"Twilio call {call_sid} was already terminated")
|
||||||
return
|
return
|
||||||
except:
|
except Exception:
|
||||||
pass # Fall through to log the raw error
|
pass # Fall through to log the raw error
|
||||||
|
|
||||||
# Log other 404 errors
|
# Log other 404 errors
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ class AWSBedrockLLMContext(OpenAILLMContext):
|
|||||||
tool_result_content = [{"json": content_json}]
|
tool_result_content = [{"json": content_json}]
|
||||||
else:
|
else:
|
||||||
tool_result_content = [{"text": message["content"]}]
|
tool_result_content = [{"text": message["content"]}]
|
||||||
except:
|
except (json.JSONDecodeError, ValueError):
|
||||||
tool_result_content = [{"text": message["content"]}]
|
tool_result_content = [{"text": message["content"]}]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ class MCPClient(BaseObject):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
logger.debug(f"Found {len(available_tools)} available tools")
|
logger.debug(f"Found {len(available_tools)} available tools")
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for tool in available_tools.tools:
|
for tool in available_tools.tools:
|
||||||
|
|||||||
Reference in New Issue
Block a user