From 5ac9cce7f0e7494a55cab4268102ed13049811ad Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 5 Mar 2026 15:03:16 -0600 Subject: [PATCH] fix: replace bare except: with except Exception: (#29) Co-Authored-By: Claude Sonnet 4.6 --- app/db_engine.py | 8 ++++---- app/routers_v3/custom_commands.py | 17 ++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/db_engine.py b/app/db_engine.py index a6f18a5..c1979cf 100644 --- a/app/db_engine.py +++ b/app/db_engine.py @@ -452,7 +452,7 @@ class Team(BaseModel): active_roster['WARa'] -= move.player.wara try: active_roster['players'].remove(move.player) - except: + except Exception: print(f'I could not drop {move.player.name}') for move in all_adds: @@ -513,7 +513,7 @@ class Team(BaseModel): # print(f'SIL dropping {move.player.name} id ({move.player.get_id()}) for {move.player.wara} WARa') try: short_roster['players'].remove(move.player) - except: + except Exception: print(f'I could not drop {move.player.name}') for move in all_adds: @@ -574,7 +574,7 @@ class Team(BaseModel): # print(f'LIL dropping {move.player.name} id ({move.player.get_id()}) for {move.player.wara} WARa') try: long_roster['players'].remove(move.player) - except: + except Exception: print(f'I could not drop {move.player.name}') for move in all_adds: @@ -2345,7 +2345,7 @@ class CustomCommand(BaseModel): try: import json return json.loads(self.tags) - except: + except Exception: return [] def set_tags_list(self, tags_list): diff --git a/app/routers_v3/custom_commands.py b/app/routers_v3/custom_commands.py index bbe3077..577e78d 100644 --- a/app/routers_v3/custom_commands.py +++ b/app/routers_v3/custom_commands.py @@ -296,9 +296,8 @@ async def get_custom_commands( if command_dict.get("tags"): try: command_dict["tags"] = json.loads(command_dict["tags"]) - except: + except Exception: command_dict["tags"] = [] - # Get full creator information creator_id = command_dict["creator_id"] creator_cursor = db.execute_sql( @@ -406,7 +405,7 @@ async def create_custom_command_endpoint( if command_dict.get("tags"): try: command_dict["tags"] = json.loads(command_dict["tags"]) - except: + except Exception: command_dict["tags"] = [] creator_created_at = command_dict.pop("creator_created_at") @@ -467,7 +466,7 @@ async def update_custom_command_endpoint( if command_dict.get("tags"): try: command_dict["tags"] = json.loads(command_dict["tags"]) - except: + except Exception: command_dict["tags"] = [] creator_created_at = command_dict.pop("creator_created_at") @@ -552,7 +551,7 @@ async def patch_custom_command( if command_dict.get("tags"): try: command_dict["tags"] = json.loads(command_dict["tags"]) - except: + except Exception: command_dict["tags"] = [] creator_created_at = command_dict.pop("creator_created_at") @@ -781,7 +780,7 @@ async def get_custom_command_stats(): if command_dict.get("tags"): try: command_dict["tags"] = json.loads(command_dict["tags"]) - except: + except Exception: command_dict["tags"] = [] command_dict["creator"] = { "discord_id": command_dict.pop("creator_discord_id"), @@ -881,7 +880,7 @@ async def get_custom_command_by_name_endpoint(command_name: str): if command_dict.get("tags"): try: command_dict["tags"] = json.loads(command_dict["tags"]) - except: + except Exception: command_dict["tags"] = [] # Add creator info - get full creator record @@ -966,7 +965,7 @@ async def execute_custom_command( if updated_dict.get("tags"): try: updated_dict["tags"] = json.loads(updated_dict["tags"]) - except: + except Exception: updated_dict["tags"] = [] # Build creator object from the fields returned by get_custom_command_by_id @@ -1053,7 +1052,7 @@ async def get_custom_command(command_id: int): if command_dict.get("tags"): try: command_dict["tags"] = json.loads(command_dict["tags"]) - except: + except Exception: command_dict["tags"] = [] creator_created_at = command_dict.pop("creator_created_at")