error envelope
A fixed wrapper shape for every error response, so clients can read any error the same way.
In more detail
Without an envelope each service returns its own mix of strings and objects, and clients need special code for each. A standard envelope, such as Problem Details, lets one piece of client code handle every error.
Example
A client-side normalizer maps Problem Details invalidParams onto form fields.Related terms
- Problem Details — A standard JSON shape for HTTP error responses, defined in RFC 9457, with members such as type, title, status, detail and instance.
- HTTP status code — The three-digit number at the start of a response, such as 200 or 404, that says how the server handled the request.
- field error — A validation failure tied to one input field, reported with the field name and a message such as "must not be blank".
- controller advice — A Spring class, marked @RestControllerAdvice, whose exception handlers apply across all controllers, giving one failure policy for every route.
Taught in
- Resilient Error Handling: Problem Details & Envelopes — Production Full-Stack Engineering
- Reading The Request — Modern Java: Virtual Threads & High-Throughput Services
- Validation — Modern Java: Virtual Threads & High-Throughput Services
- Exception Handling To Problem Details — Modern Java: Virtual Threads & High-Throughput Services