Class ValidationException

All Implemented Interfaces:
Serializable

public class ValidationException extends RuntimeException
Thrown when an entity fails framework validation on the write path — a missing required attribute, an out-of-range / malformed value, or a failed BusinessRule.

A distinct typed exception (not a raw IllegalStateException) so the web layer maps it to a 4xx instead of a 500. It carries both a single getField() (for the simple one-field case — e.g. a missing required attribute on a public intake repository.save, issue #32) and the richer fieldErrors() / formErrors() collected by ValidationErrors, so a form can map every failure onto the right input at once. The UI starter registers a handler that performs the HTTP mapping; headless apps can catch this directly.

See Also:
  • Constructor Details

    • ValidationException

      public ValidationException(String message)
    • ValidationException

      public ValidationException(String message, String field)
      A single-field (or, when field is null, form-level) failure.
    • ValidationException

      public ValidationException(String message, Map<String,List<String>> fieldErrors, List<String> formErrors)
      Multiple collected failures, keyed by field plus any form-level messages.
  • Method Details

    • getField

      public String getField()
    • fieldErrors

      public Map<String,List<String>> fieldErrors()
      Per-field messages, keyed by attribute field name, in declaration order.
    • formErrors

      public List<String> formErrors()
      Cross-field / form-level messages not tied to a specific input.