fix(web): surface media fetch failures

This commit is contained in:
Peter Steinberger
2025-12-03 13:47:13 +00:00
parent 92a0763a74
commit a321bf1a90
4 changed files with 65 additions and 3 deletions

View File

@@ -559,7 +559,15 @@ async function deliverWebReply(params: {
);
replyLogger.warn({ err, mediaUrl }, "failed to send web media reply");
if (index === 0) {
const fallbackText = remainingText.shift() ?? caption ?? "";
const warning =
err instanceof Error
? `⚠️ Media failed: ${err.message}`
: "⚠️ Media failed.";
const fallbackTextParts = [
remainingText.shift() ?? caption ?? "",
warning,
].filter(Boolean);
const fallbackText = fallbackTextParts.join("\n");
if (fallbackText) {
console.log(`⚠️ Media skipped; sent text-only to ${msg.from}`);
await msg.reply(fallbackText);