fix: remove empty finally clauses in custom_commands and help_commands
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m17s

After removing db.close() calls, 22 finally: blocks were left empty
(12 in custom_commands.py, 10 in help_commands.py), causing
IndentationError at import time. Removed the finally: clause entirely
since connection lifecycle is now handled by the middleware.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-03-27 06:34:37 -05:00
parent ab90dfc437
commit ac2c5920ce
2 changed files with 0 additions and 22 deletions

View File

@ -363,7 +363,6 @@ async def get_custom_commands(
except Exception as e:
logger.error(f"Error getting custom commands: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
# Move this route to after the specific string routes
@ -428,7 +427,6 @@ async def create_custom_command_endpoint(
except Exception as e:
logger.error(f"Error creating custom command: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.put("/{command_id}", include_in_schema=PRIVATE_IN_SCHEMA)
@ -488,7 +486,6 @@ async def update_custom_command_endpoint(
except Exception as e:
logger.error(f"Error updating custom command {command_id}: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.patch("/{command_id}", include_in_schema=PRIVATE_IN_SCHEMA)
@ -572,7 +569,6 @@ async def patch_custom_command(
except Exception as e:
logger.error(f"Error patching custom command {command_id}: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.delete("/{command_id}", include_in_schema=PRIVATE_IN_SCHEMA)
@ -608,7 +604,6 @@ async def delete_custom_command_endpoint(
except Exception as e:
logger.error(f"Error deleting custom command {command_id}: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
# Creator endpoints
@ -678,7 +673,6 @@ async def get_creators(
except Exception as e:
logger.error(f"Error getting creators: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.post("/creators", include_in_schema=PRIVATE_IN_SCHEMA)
@ -722,7 +716,6 @@ async def create_creator_endpoint(
except Exception as e:
logger.error(f"Error creating creator: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.get("/stats")
@ -847,7 +840,6 @@ async def get_custom_command_stats():
except Exception as e:
logger.error(f"Error getting custom command stats: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
# Special endpoints for Discord bot integration
@ -913,7 +905,6 @@ async def get_custom_command_by_name_endpoint(command_name: str):
except Exception as e:
logger.error(f"Error getting custom command by name '{command_name}': {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.patch("/by_name/{command_name}/execute", include_in_schema=PRIVATE_IN_SCHEMA)
@ -981,7 +972,6 @@ async def execute_custom_command(
except Exception as e:
logger.error(f"Error executing custom command '{command_name}': {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.get("/autocomplete")
@ -1017,7 +1007,6 @@ async def get_command_names_for_autocomplete(
except Exception as e:
logger.error(f"Error getting command names for autocomplete: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.get("/{command_id}")
@ -1066,4 +1055,3 @@ async def get_custom_command(command_id: int):
except Exception as e:
logger.error(f"Error getting custom command {command_id}: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:

View File

@ -138,7 +138,6 @@ async def get_help_commands(
except Exception as e:
logger.error(f"Error getting help commands: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.post("/", include_in_schema=PRIVATE_IN_SCHEMA)
@ -186,7 +185,6 @@ async def create_help_command_endpoint(
except Exception as e:
logger.error(f"Error creating help command: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.put("/{command_id}", include_in_schema=PRIVATE_IN_SCHEMA)
@ -236,7 +234,6 @@ async def update_help_command_endpoint(
except Exception as e:
logger.error(f"Error updating help command {command_id}: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.patch("/{command_id}/restore", include_in_schema=PRIVATE_IN_SCHEMA)
@ -274,7 +271,6 @@ async def restore_help_command_endpoint(
except Exception as e:
logger.error(f"Error restoring help command {command_id}: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.delete("/{command_id}", include_in_schema=PRIVATE_IN_SCHEMA)
@ -305,7 +301,6 @@ async def delete_help_command_endpoint(
except Exception as e:
logger.error(f"Error deleting help command {command_id}: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.get("/stats")
@ -363,7 +358,6 @@ async def get_help_command_stats():
except Exception as e:
logger.error(f"Error getting help command stats: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
# Special endpoints for Discord bot integration
@ -396,7 +390,6 @@ async def get_help_command_by_name_endpoint(
except Exception as e:
logger.error(f"Error getting help command by name '{command_name}': {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.patch("/by_name/{command_name}/view", include_in_schema=PRIVATE_IN_SCHEMA)
@ -432,7 +425,6 @@ async def increment_view_count(command_name: str, token: str = Depends(oauth2_sc
except Exception as e:
logger.error(f"Error incrementing view count for '{command_name}': {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.get("/autocomplete")
@ -462,7 +454,6 @@ async def get_help_names_for_autocomplete(
except Exception as e:
logger.error(f"Error getting help names for autocomplete: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally:
@router.get("/{command_id}")
@ -490,4 +481,3 @@ async def get_help_command(command_id: int):
except Exception as e:
logger.error(f"Error getting help command {command_id}: {e}")
raise HTTPException(status_code=500, detail=str(e))
finally: