fix(telegram): surface fallback on dispatch failures (#39209, thanks @riftzen-bit)

Co-authored-by: riftzen-bit <binb53339@gmail.com>
This commit is contained in:
Peter Steinberger
2026-03-07 22:40:53 +00:00
parent f53e10e3fd
commit 99de6515a0
6 changed files with 88 additions and 20 deletions

View File

@@ -262,8 +262,21 @@ export const registerTelegramHandlers = ({
replyMedia,
);
},
onError: (err) => {
onError: (err, items) => {
runtime.error?.(danger(`telegram debounce flush failed: ${String(err)}`));
const chatId = items[0]?.msg.chat.id;
if (chatId != null) {
const threadId = items[0]?.msg.message_thread_id;
void bot.api
.sendMessage(
chatId,
"Something went wrong while processing your message. Please try again.",
threadId != null ? { message_thread_id: threadId } : undefined,
)
.catch((sendErr) => {
logVerbose(`telegram: error fallback send failed: ${String(sendErr)}`);
});
}
},
});