From 8307c6b8444dc79113ff004929e151f1ac5729d8 Mon Sep 17 00:00:00 2001 From: Jose Lago Date: Wed, 17 Jun 2026 12:17:40 +0200 Subject: [PATCH] fix: wrap callback router in try/except to expose swallowed errors --- worker/src/bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/worker/src/bot.py b/worker/src/bot.py index d9fdd5a..09070e2 100644 --- a/worker/src/bot.py +++ b/worker/src/bot.py @@ -434,13 +434,23 @@ async def text_input_handler(update: Update, context: ContextTypes.DEFAULT_TYPE) async def callback_router(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: """Route all callback queries by prefix pattern.""" + try: + _handle_callback(update, context) + except Exception: + logger.exception("Callback handler error for %s", update.callback_query.data if update.callback_query else "unknown") + + +async def _handle_callback(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: query = update.callback_query if not query or not query.data: return await query.answer() # dismiss loading indicator + logger.info("Callback received: %s", query.data) + user = await _require_user(update) if not user: + logger.warning("Callback rejected: user not found or inactive") return data = query.data