ApiError class

A classified API error with context.

Constructors

ApiError({required ApiErrorType type, required String message, int? statusCode, String? retryAfter, int? tokenGap, Map<String, dynamic>? rawError})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
isAuthError bool
Whether this is an authentication or authorization error.
no setter
isRetryable bool
Whether this error type is safe to retry automatically.
no setter
message String
Human-readable error description.
final
rawError Map<String, dynamic>?
The raw error payload from the API response.
final
retryAfter String?
Value of the Retry-After header, if present.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int?
HTTP status code, if applicable.
final
tokenGap int?
Number of tokens exceeding the context window (for promptTooLong errors).
final
type ApiErrorType
The classified error category.
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