AimuxException class
Base class for aimux AiMuxErrors only.
Use subclasses for specific handling (on APICallError,
on AimuxTimeoutError, …). Recording failures use the independent
RecordingException; C ABI failures surface as native Dart
errors (see expectAimuxError).
HTTP-shaped failures are all APICallError — branch on status
(401 auth, 404 model, 429 rate limit).
Fields mirror the C aimux_error_* getters / core helpers:
- code: error code (AimuxErrorCode)
- status: HTTP status, or
-1 - retryMs: rate-limit hint, or
-1(0= retry now) - retryable: whether retrying may help
- message: human-readable text
Per-code payload lives on the carrying subclass only: APICallError
(providerCode/providerMessage/url/requestBodyValues/
responseHeaders/responseBody/data), RetryError (reason/errors),
NoSuchModelError (modelId/modelType), NoSuchProviderError
(providerId).
NoSuchToolError (toolName/availableTools), InvalidToolInputError
(toolName/toolInput), ToolCallRepairError (originalError).
- Implemented types
- Implementers
Constructors
- AimuxException(String message, {int code = AimuxErrorCode.other, int status = -1, int retryMs = -1, bool retryable = false})
- AimuxException.fromCode(int code, String message, {int status = -1, int retryMs = -1, bool retryable = false})
-
Dispatch
code→ concrete subclass (defaults for status when-1).factory
Properties
- code → int
-
Machine-readable error code (AimuxErrorCode constants).
final
- codeName → String
-
Core
error_type()name for code.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
Human-readable failure text.
final
- retryable → bool
-
Whether retrying may help — the
AiMuxErrorverdict, carried across the C ABI. Not derivable from status: a transport failure (request went out, connection reset) and a missing API key (request never went out) both reportstatus == -1and disagree here.final - retryMs → int
-
Rate-limit hint in ms;
-1if none;0means retry immediately.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → int
-
HTTP status when known; otherwise
-1.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