NetworkAppException class abstract
Base class for network-related application exceptions.
Represents failures that occur during HTTP requests to the My Fuel Orders backend, such as connection timeouts, server errors, authentication failures, or malformed responses.
Wraps DioException to preserve low-level network details while providing a consistent exception hierarchy for the application layer.
Example:
try {
await apiProvider.getOrders();
} catch (e) {
if (e is NetworkAppException) {
if (e.originalException?.response?.statusCode == 401) {
// Handle authentication failure.
}
}
}
See also:
- AppException for the base exception class.
- AppExceptionMappingInterceptor for mapping Dio errors to app exceptions.
- Inheritance
-
- Object
- AppException
- NetworkAppException
- Implementers
Constructors
- NetworkAppException({required String message, DioException? originalException, String? errorCode, String? traceId})
-
Creates a network exception with the given
message.const
Properties
- errorCode → String?
-
A machine-readable error code from the backend's
ErrorResponseenvelope (e.g.VALIDATION_ERROR,TOO_MANY_REQUESTS), ornullif the response body didn't match that schema.final - hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
A human-readable description of the error.
finalinherited
- originalException → DioException?
-
The underlying Dio exception that caused this network error.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- traceId → String?
-
The backend's request-trace identifier from the
ErrorResponseenvelope, for correlating this error with server-side logs — ornullif the response body didn't match that schema.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
The string representation of this exception, including Dio-level details.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited