0002: RFC 9457 Problem Details for all errors¶
Status: Accepted
Context¶
Errors had three different shapes: {"detail": str} from HTTPException, {"detail": [...]} from validation, and Starlette's plain-text 404/405. Clients needed special cases for each.
Decision¶
Every error is application/problem+json with type, title, status, detail and instance. Business code raises domain exceptions (app/core/exceptions.py); handlers map them to HTTP. For backwards compatibility with existing clients:
- detail is a human-readable string for application errors
- for 422, detail remains FastAPI's list of field errors.
Consequences¶
Clients can rely on status and detail everywhere. Specific type URIs can be introduced per error class later without breaking clients.