ValidationException class
Exception for validation errors.
Use this for input validation failures, constraint violations, etc.
if (email.isEmpty) {
throw ValidationException('Email is required', field: 'email');
}
if (!emailRegex.hasMatch(email)) {
throw ValidationException('Invalid email format', field: 'email');
}
- Inheritance
-
- Object
- JuiceException
- ValidationException
Constructors
-
ValidationException(String message, {String? field, Map<
String, String> ? errors, Object? cause, StackTrace? stackTrace}) -
Creates a ValidationException.
const
Properties
- cause → Object?
-
The underlying error that caused this exception, if any.
finalinherited
-
errors
→ Map<
String, String> ? -
Multiple validation errors, keyed by field name.
final
- field → String?
-
The field that failed validation, if applicable.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isNetworkError → bool
-
Whether this is a network-related error.
no setterinherited
- isRetryable → bool
-
Validation errors are not retryable without user action.
no setteroverride
- isTimeoutError → bool
-
Whether this is a timeout error.
no setterinherited
- isValidationError → bool
-
Whether this is a validation error.
no setteroverride
- message → String
-
Human-readable error message.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
The stack trace where this exception occurred.
finalinherited
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