Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

489 B
Raw Blame
import { isImageDecodingRequestError, shouldStopFallbackForError } from '../../utils/routeFallback';

/** Whether a failed attempt may fall back to the next channel, and why not when it may not. */
export const classifyAttemptError = (error: unknown) => {
  const nonRetryable = shouldStopFallbackForError(error);
  const nonRetryableReason =
    nonRetryable && isImageDecodingRequestError(error) ? ('imageDecode' as const) : undefined;

  return { nonRetryable, nonRetryableReason };
};