AppException class abstract

Base exception class for application-specific errors in Driver Lite.

Provides a common interface for all custom exceptions, ensuring consistent error handling and messaging across different error types.

Subclasses should represent specific error categories such as network failures, validation errors, or business logic violations. This allows error handling code to catch and respond to specific error types while maintaining a unified exception hierarchy.

Example subclasses:

class NetworkAppException extends AppException {
  const NetworkAppException({required super.message});
}

class ValidationException extends AppException {
  const ValidationException({required super.message});
}

Usage:

try {
  await placeOrder();
} catch (e) {
  if (e is AppException) {
    // Handle application-specific error
    showErrorDialog(e.message);
  } else {
    // Handle unexpected errors
    logUnknownError(e);
  }
}

See also:

Implemented types
Implementers

Constructors

AppException({required String message})
Creates an application exception with the given error message.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
message String
A human-readable description of the error.
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
The string representation of this exception for debugging.
override

Operators

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