Loading lesson…
Level 1 · Apprentice0 XP
Reject bad input early and return errors every client can read.
Step 1 / 5
ProblemA blank email goes straight to the service and the database throws a vague 500. Each controller invents its own error format, and sometimes the stack trace leaks to the client.
← → step
Before this: Designing a REST API
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Add @Valid to a POST endpoint with a DTO that has @NotBlank and @Email. Add a @RestControllerAdvice that turns your own NotFound exception into a 404 ProblemDetail. Call it with curl and check the three responses: 201, 400, 404.