JuiceException class abstract
Base exception class for Juice framework errors.
All Juice-specific exceptions extend this class, enabling consistent error handling and categorization across the application.
Usage
try {
await fetchData();
} on JuiceException catch (e) {
if (e.isRetryable) {
// Retry the operation
}
emitFailure(newState: state.copyWith(error: e.message));
}
Custom Exceptions
class MyCustomException extends JuiceException {
MyCustomException(String message) : super(message);
@override
bool get isRetryable => false;
}
- Implemented types
- Implementers
Constructors
- JuiceException(String message, {Object? cause, StackTrace? stackTrace})
-
Creates a JuiceException with a message and optional cause.
const
Properties
- cause → Object?
-
The underlying error that caused this exception, if any.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isNetworkError → bool
-
Whether this is a network-related error.
no setter
- isRetryable → bool
-
Whether this error is potentially recoverable by retrying.
no setter
- isTimeoutError → bool
-
Whether this is a timeout error.
no setter
- isValidationError → bool
-
Whether this is a validation error.
no setter
- message → String
-
Human-readable error message.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
The stack trace where this exception occurred.
final
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