ErrorType enum
Enum representing specific types of errors that can occur in API requests.
This provides a more granular categorization of errors beyond just HTTP status codes, allowing for more specific handling and recovery strategies.
Values
- network → const ErrorType
-
Network errors like no internet connection, timeout, etc.
- authentication → const ErrorType
-
Authentication errors like invalid credentials, expired token, etc.
-
Authorization errors like insufficient permissions, forbidden access, etc.
- validation → const ErrorType
-
Request errors like invalid parameters, missing required fields, etc.
- server → const ErrorType
-
Server errors like internal server error, service unavailable, etc.
- notFound → const ErrorType
-
Resource not found errors
- parsing → const ErrorType
-
Parsing errors like invalid JSON, unexpected format, etc.
- timeout → const ErrorType
-
Timeout errors when a request takes too long
- cancelled → const ErrorType
-
Cancellation errors when a request is manually cancelled
- rateLimit → const ErrorType
-
Rate limit errors when too many requests are made
- unknown → const ErrorType
-
Unknown or uncategorized errors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userFriendlyMessage → String
-
Returns a user-friendly error message for this error type.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromDioErrorType(
dynamic dioErrorType) → ErrorType - Maps a Dio error type to an ErrorType.
-
fromStatusCode(
int statusCode) → ErrorType - Converts an HTTP status code to a specific error type.