MCPcopy Create free account
hub / github.com/pollinations/pollinations / getDefaultErrorMessage

Function getDefaultErrorMessage

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

Source from the content-addressed store, hash-verified

352export type ErrorStatusCode = (typeof KNOWN_ERROR_STATUS_CODES)[number];
353
354export function getDefaultErrorMessage(status: number): string {
355 const messages: Record<number, string> = {
356 400: "Something was wrong with the input data, check the details for more info.",
357 401: "Authentication required. Please provide an API key via Authorization header (Bearer token) or ?key= query parameter.",
358 402: "Insufficient pollen balance or API key budget exhausted.",
359 403: "Access denied! You don't have the required permissions for this resource or model.",
360 404: "Oh no, there's nothing here.",
361 405: "That HTTP method isn't supported here. Please check the API docs.",
362 409: "Something with these details already exists. Maybe update it instead?",
363 422: "Your request looks good, but some required fields are missing or invalid.",
364 426: "This endpoint requires a WebSocket upgrade request.",
365 429: "You're making requests too quickly. Please slow down a bit.",
366 500: "Oh snap, something went wrong on our end. We're on it!",
367 502: "We couldn't reach our backend services. Please try again shortly.",
368 503: "We're temporarily down for maintenance. Sorry about that!",
369 };
370 return messages[status] || "UNKNOWN_ERROR";
371}
372
373async function emitServerError<TEnv extends ErrorHandlerEnv>(
374 c: Context<TEnv>,

Callers 7

collectErrorDataFunction · 0.90
ensureUpstreamOkFunction · 0.85
handleErrorFunction · 0.85
createErrorResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected