Skip to main content

Error Responses: ProblemDetail and Error Codes

Learn Error Responses: ProblemDetail and Error Codes (Exception Handling, Spring Boot) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

What a Good Error Response Contains When something fails, the client needs to know four things: what happened (a stable code), why (a human message), which part of the request was wrong (for validation), and how to find it in the logs (a trace id). It also needs the correct HTTP status. Use one shape for every error in the API. A client that must handle five different error formats will handle none of them well.

More lessons in Exception Handling