AiException class Errors

The base error for every failure raised by this package.

Carries the human-readable message, the provider that produced it, an optional HTTP statusCode, and an optional underlying cause. Concrete subclasses narrow the failure mode (auth, rate limit, and so on) and give a distinct toString label.

Throws an AiException subclass when the call fails: AiAuthException for rejected credentials, AiRateLimitException when rate limited, AiInvalidRequestException for a rejected request, AiTransientException for a network or 5xx failure, or AiResponseException for an unusable response body.

Implemented types
Implementers

Constructors

AiException(String message, {required String provider, int? statusCode, Object? cause})
Creates an AiException for provider with message.

Properties

cause Object?
The underlying error or exception, when this wraps another failure.
final
hashCode int
The hash code for this object.
no setterinherited
message String
A human-readable description of what went wrong.
final
provider String
The provider id that produced this error (for example openai).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int?
The HTTP status code, when the failure originated from a response.
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