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:
|
async def callback_router(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||||
"""Route all callback queries by prefix pattern."""
|
"""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
|
query = update.callback_query
|
||||||
if not query or not query.data:
|
if not query or not query.data:
|
||||||
return
|
return
|
||||||
|
|
||||||
await query.answer() # dismiss loading indicator
|
await query.answer() # dismiss loading indicator
|
||||||
|
logger.info("Callback received: %s", query.data)
|
||||||
|
|
||||||
user = await _require_user(update)
|
user = await _require_user(update)
|
||||||
if not user:
|
if not user:
|
||||||
|
logger.warning("Callback rejected: user not found or inactive")
|
||||||
return
|
return
|
||||||
|
|
||||||
data = query.data
|
data = query.data
|
||||||
|
|||||||
Reference in New Issue
Block a user