fix: wrap callback router in try/except to expose swallowed errors
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user