Bad request
| Type URI | https://doc.expresso-ts.com/docs/errors/bad-request |
| HTTP status | 400 |
The request could not be understood as it was sent.
When it is sent
- A handler throws
AppError.badRequest(message, details?). - Middleware rejects the request with a 400, for example the body parser on malformed JSON. The middleware's own message is the
detail.
{
"type": "https://doc.expresso-ts.com/docs/errors/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "Start date must be before end date",
"instance": "/api/reports"
}
A body that is well-formed but breaks a validation rule is a different type: validation-failed.
What to do
Read detail: it says what was wrong with this request. When the error came from AppError.badRequest with a second argument, that object is in details.
See Error responses for the shape of the document and how to turn it on.