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

@@ -70,7 +70,7 @@ class UrlToImageProcessor(FrameProcessor):
return data["artObject"]["webImage"]["url"]
if "artworks" in data and len(data["artworks"]):
return data["artworks"][0]["webImage"]["url"]
except:
except (json.JSONDecodeError, KeyError, TypeError):
pass
return None

View File

@@ -72,7 +72,7 @@ class UrlToImageProcessor(FrameProcessor):
return data["artObject"]["webImage"]["url"]
if "artworks" in data and len(data["artworks"]):
return data["artworks"][0]["webImage"]["url"]
except:
except (json.JSONDecodeError, KeyError, TypeError):
pass
async def run_image_process(self, image_url: str):