Validation Pipeline
Challenge on lesson: Checkpoint: Error Architecture
CHALLENGE
Difficulty: intermediate+25 XP
Build Solution:
- static class ValidationException extends RuntimeException carrying
List<String> errors (getter errors()); message joins the errors.
- static void validate(List<String> fields): collect ALL failures โ
blank fields (null or isBlank) become error
"field " + index + " blank"; then throw ValidationException with the
full error list if any.
- static int firstError(RuntimeException e): returns 0 when e is a
ValidationException, -1 otherwise.
Fail-fast would have stopped at the first problem โ you collect everything,
which is what a validation *pipeline* means.
Press Submit to check your solution.
Back to lesson: Checkpoint: Error Architecture