mirror of
https://github.com/moeru-ai/airi.git
synced 2026-10-31 03:44:38 +08:00
@proj-airi/http-error-shared
The HTTP error model that the resource API and the auth service share.
Use it for
ApiErrorand its factory functions, for each error that a route, middleware, or service returns to a client.createErrorHandler, as the HonoonErrorhandler of a service.
Do not use it for
- Success responses. A route returns its resource directly.
- Provider-specific error bodies that a gateway route forwards.
- Importing
server/apps/apiorserver/apps/auth.
Error response
Each error response has this JSON body and the HTTP status of the error.
{ "error": "BAD_REQUEST", "message": "Invalid auth event", "details": {} }
details is optional. Throw an ApiError. Do not write this body in a route or middleware.