ValidationException class

The base of the exceptions that mean validation itself is set up wrongly: a bad constraint declaration or group definition, never an invalid value.

Invalid values are reported as violations or errors, not thrown. One of these is a programming error to fix in the code; you do not normally catch it, except to report it. Jakarta's ValidationException.

try {
  validator.validateObject(form);
} on ValidationException catch (e) {
  log.error(e.message); // a wrong declaration, not an invalid form
}

Spring (Java):

} catch (jakarta.validation.ValidationException e) { ... }
Implemented types

Constructors

ValidationException(String message)
An exception explaining the problem in message.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
message → String
What is wrong and where, for the developer.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited