feat: keep error status until polling recovers, classify unconfirmed deliveries, document the UI
Validate / validate (push) Successful in 9m52s
Validate / validate (push) Successful in 9m52s
- the poll loop now clears its error status after the next successful getUpdates, not before the retry, so a slow retry never shows as healthy - recovery is reported only when getUpdates itself failed - a send that may have reached Telegram is reported as unconfirmed instead of failed - README and CHANGELOG describe the states, toasts, queue preview and spinner text
This commit is contained in:
1 parent
057281a3bb
commit
6f7e266a6e
8 files changed
+144
-19
No files matched your search
+12
-8
@@ -36,22 +36,26 @@ export interface TelegramNoticeRuntime<TContext> {
|
||||
}
|
||||
|
||||
function describeTelegramDeliveryFailure(error: unknown): {
|
||||
reason: string;
|
||||
message: string;
|
||||
level: TelegramNoticeLevel;
|
||||
} {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
const summary = summarizeTelegramStatusError(message);
|
||||
if (summary?.deliveryUnknown) {
|
||||
return {
|
||||
message: "Telegram: reply delivery unconfirmed (check the chat)",
|
||||
level: "warning",
|
||||
};
|
||||
}
|
||||
if (summary) {
|
||||
return {
|
||||
reason: summary.label,
|
||||
message: `Telegram: reply not delivered (${summary.label})`,
|
||||
level: summary.kind === "fatal" ? "error" : "warning",
|
||||
};
|
||||
}
|
||||
const raw = sanitizeTelegramStatusText(message);
|
||||
return {
|
||||
reason: raw.length > 80 ? `${raw.slice(0, 79)}…` : raw,
|
||||
level: "error",
|
||||
};
|
||||
const reason = raw.length > 80 ? `${raw.slice(0, 79)}…` : raw;
|
||||
return { message: `Telegram: reply not delivered (${reason})`, level: "error" };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,8 +97,8 @@ export function createTelegramNoticeRuntime<TContext>(
|
||||
return;
|
||||
}
|
||||
lastDeliveryNoticeAtMs = nowMs;
|
||||
const { reason, level } = describeTelegramDeliveryFailure(error);
|
||||
show(ctx, `Telegram: reply not delivered (${reason})`, level);
|
||||
const failure = describeTelegramDeliveryFailure(error);
|
||||
show(ctx, failure.message, failure.level);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user