Files
openclaw/extensions/telegram/src/send-error-predicates.ts
2026-07-31 09:33:27 -07:00

14 lines
526 B
TypeScript

import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
const TELEGRAM_PHOTO_LIMIT_ERROR_RE = /\b(?:PHOTO_INVALID_DIMENSIONS|PHOTO_TOO_BIG)\b/i;
export function isTelegramPhotoLimitError(error: unknown): boolean {
const description =
error && typeof error === "object" && "description" in error
? (error as { description?: unknown }).description
: undefined;
return TELEGRAM_PHOTO_LIMIT_ERROR_RE.test(
typeof description === "string" ? description : formatErrorMessage(error),
);
}