Error Handling
Custom Error Classes
| Error Class | HTTP Status |
|---|---|
ValidationError | 400 |
UnauthorizedError | 401 |
NotFoundError | 404 |
ConflictError | 409 |
Error Response Shape
All errors are caught by toErrorResponse() middleware and returned as:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Human-readable message"
}
}On the frontend, api-client.ts unwraps this into error.message, so in components just read e?.message.
Last updated on