chore(security): replace silent exception swallowing across handlers

This commit is contained in:
kavore
2026-02-08 21:30:39 +03:00
parent 199c7797f5
commit da03510a92
16 changed files with 322 additions and 316 deletions
@@ -30,20 +30,20 @@ async def pay_fk_callback_handler(
if not i18n or not callback.message:
try:
await callback.answer(get_text("error_occurred_try_again"), show_alert=True)
except Exception:
pass
except Exception as exc:
logging.debug("Suppressed exception in bot/handlers/user/subscription/payments_freekassa.py: %s", exc)
return
if not freekassa_service or not freekassa_service.configured:
logging.error("FreeKassa service is not configured or unavailable.")
try:
await callback.answer(get_text("payment_service_unavailable_alert"), show_alert=True)
except Exception:
pass
except Exception as exc:
logging.debug("Suppressed exception in bot/handlers/user/subscription/payments_freekassa.py: %s", exc)
try:
await callback.message.edit_text(get_text("payment_service_unavailable"))
except Exception:
pass
except Exception as exc:
logging.debug("Suppressed exception in bot/handlers/user/subscription/payments_freekassa.py: %s", exc)
return
try:
@@ -56,8 +56,8 @@ async def pay_fk_callback_handler(
logging.error(f"Invalid pay_fk data in callback: {callback.data}")
try:
await callback.answer(get_text("error_try_again"), show_alert=True)
except Exception:
pass
except Exception as exc:
logging.debug("Suppressed exception in bot/handlers/user/subscription/payments_freekassa.py: %s", exc)
return
user_id = callback.from_user.id
@@ -95,12 +95,12 @@ async def pay_fk_callback_handler(
)
try:
await callback.message.edit_text(get_text("error_creating_payment_record"))
except Exception:
pass
except Exception as exc:
logging.debug("Suppressed exception in bot/handlers/user/subscription/payments_freekassa.py: %s", exc)
try:
await callback.answer(get_text("error_try_again"), show_alert=True)
except Exception:
pass
except Exception as exc:
logging.debug("Suppressed exception in bot/handlers/user/subscription/payments_freekassa.py: %s", exc)
return
success, response_data = await freekassa_service.create_order(
@@ -181,12 +181,12 @@ async def pay_fk_callback_handler(
),
disable_web_page_preview=False,
)
except Exception:
pass
except Exception as exc:
logging.debug("Suppressed exception in bot/handlers/user/subscription/payments_freekassa.py: %s", exc)
try:
await callback.answer()
except Exception:
pass
except Exception as exc:
logging.debug("Suppressed exception in bot/handlers/user/subscription/payments_freekassa.py: %s", exc)
return
logging.error(
@@ -214,9 +214,9 @@ async def pay_fk_callback_handler(
try:
await callback.message.edit_text(get_text("error_payment_gateway"))
except Exception:
pass
except Exception as exc:
logging.debug("Suppressed exception in bot/handlers/user/subscription/payments_freekassa.py: %s", exc)
try:
await callback.answer(get_text("error_payment_gateway"), show_alert=True)
except Exception:
pass
except Exception as exc:
logging.debug("Suppressed exception in bot/handlers/user/subscription/payments_freekassa.py: %s", exc)