The server uses specific JSON structures for error responses depending on the error type encountered during request processing.
Validation Errors (400 Bad Request):
When a ZodError or HttpValidationError occurs, the server returns an errors object where keys are the field names and values are the error messages.
{
"errors": {
"field_name": "error message"
}
}
Generic Errors (400 Bad Request):
For malformed requests where the pathname cannot be parsed:
{
"error": "Bad request"
}
Internal Server Errors (500 Internal Server Error):
For unhandled exceptions:
{
"error": "Internal server error"
}
Not Found (404 Not Found):
When no route matches the request:
{
"error": "Not found"
}