(status: number)
| 352 | export type ErrorStatusCode = (typeof KNOWN_ERROR_STATUS_CODES)[number]; |
| 353 | |
| 354 | export 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 | |
| 373 | async function emitServerError<TEnv extends ErrorHandlerEnv>( |
| 374 | c: Context<TEnv>, |
no outgoing calls
no test coverage detected