File size: 494 Bytes
fc93158 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | export const MODEL_AVAILABILITY_UNAVAILABLE_CODE = "MODEL_AVAILABILITY_UNAVAILABLE";
export function formatErrorWithStack(err: unknown): string {
if (err instanceof Error) {
return err.stack ?? `${err.name}: ${err.message}`;
}
return String(err);
}
export function shouldFallbackToAuthHeuristics(err: unknown): boolean {
if (!(err instanceof Error)) {
return false;
}
const code = (err as { code?: unknown }).code;
return code === MODEL_AVAILABILITY_UNAVAILABLE_CODE;
}
|