ValidationException class base
Thrown when validation fails; rendered as a Laravel-compatible 422:
{"message": "...", "errors": {"field": ["..."]}}.
- Inheritance
-
- Object
- DaravelException
- HttpException
- ValidationException
Constructors
-
ValidationException(Map<
String, List< errors)String> > -
A 422 with the messages of each field in
errors; the message is the first error, plus how many more, as Laravel writes it. -
ValidationException.withMessages(Map<
String, Object> messages) -
Builds an exception from literal messages (
withMessages).factory
Properties
-
errors
→ Map<
String, List< String> > -
Errors keyed by attribute (
items.0.id).final - hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
Extra headers to send with the rendered response.
finalinherited
- message → String
-
Human readable description of the failure.
finalinherited
- prettyJson → bool
-
Whether the default renderer writes the body pretty-printed, as
Laravel's
Handler::prepareJsonResponsedoes for every HTTP error (JSON_PRETTY_PRINT).AuthenticationExceptionoverrides it: Laravel answers that one with a plainresponse()->json.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → int
-
HTTP status code.
finalinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> - JSON payload rendered by the exception handler.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited