MCPcopy Index your code
hub / github.com/pollinations/pollinations / getErrorCode

Function getErrorCode

shared/error.ts:330–346  ·  view source on GitHub ↗
(status: number)

Source from the content-addressed store, hash-verified

328}
329
330export function getErrorCode(status: number): string {
331 const codes: Record<number, string> = {
332 400: "BAD_REQUEST",
333 401: "UNAUTHORIZED",
334 402: "PAYMENT_REQUIRED",
335 403: "FORBIDDEN",
336 404: "NOT_FOUND",
337 405: "METHOD_NOT_ALLOWED",
338 409: "CONFLICT",
339 422: "UNPROCESSABLE_ENTITY",
340 429: "RATE_LIMITED",
341 500: "INTERNAL_ERROR",
342 502: "BAD_GATEWAY",
343 503: "SERVICE_UNAVAILABLE",
344 };
345 return codes[status] || "UNKNOWN_ERROR";
346}
347
348export const KNOWN_ERROR_STATUS_CODES = [
349 400, 401, 402, 403, 405, 409, 422, 426, 429, 500, 502, 503,

Callers 4

collectErrorDataFunction · 0.90
createErrorResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected