MCPcopy
hub / github.com/AstrBotDevs/AstrBot / isLegacyFallbackError

Function isLegacyFallbackError

dashboard/src/api/v1.ts:196–209  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

194}
195
196export function isLegacyFallbackError(error: unknown): boolean {
197 const axiosError = error as {
198 response?: { status?: number; data?: { message?: string } | string };
199 message?: string;
200 };
201 if (axiosError.response?.status === 404) {
202 return true;
203 }
204
205 const data = axiosError.response?.data;
206 const message =
207 typeof data === 'string' ? data : data?.message || axiosError.message || '';
208 return message.toLowerCase().includes('missing api key');
209}
210
211function withLegacyFallback<T>(
212 primary: Promise<unknown>,

Callers 1

withLegacyFallbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected