errors library

Classes

AimuxCError
C AimuxError layout (40 bytes on 64-bit targets).
AimuxErrorCode
Machine-readable codes. Values match C AimuxErrorCode / Go Code. 14 variant codes, numbered consecutively 1–14. Every HTTP-shaped failure arrives as apiCall, classified by AimuxException.status (401 auth, 404 model, 429 rate limit; no status = transport failure).

Properties

aimuxFreeString → void Function(Pointer<Utf8>)
aimux_free_string — frees engine-allocated strings, including err->message. Lazily initialized so pure-Dart tests that never produce a native message do not dlopen the library.
final

Functions

clearAimuxCError(Pointer<AimuxCError> err) → void
Reset err to OK / no hint / no message (mirrors aimux_error_clear).
construct2(String apiKey, String modelId, String? baseUrl, int plain(Pointer<Utf8>, Pointer<Utf8>, Pointer<AimuxCError>), int withBase(Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Pointer<AimuxCError>)) int
Shared constructor for (api_key, model_id[, base_url]) providers.
openAimuxLibrary() DynamicLibrary
Opens the aimux-ffi native library for the current platform.
takeHandle(int handle, Pointer<AimuxCError> err) int
Take a constructor uint64_t handle; throw AimuxException when 0.
takeString(Pointer<Utf8> ptr, Pointer<AimuxCError> err) String
Take an owned C string result; free it; throw AimuxException on null.
withAimuxCError<T>(T fn(Pointer<AimuxCError> err)) → T
Allocate a cleared AimuxCError, run fn, free the engine-allocated message (if any) and the struct itself.
withUtf8<T>(String s, T fn(Pointer<Utf8>)) → T
Run fn with a temporary native UTF-8 copy of s; always frees it.

Exceptions / Errors

AimuxException
Base class for all aimux engine / binding failures.
AimuxTimeoutError
Request timed out. (Prefixed to avoid shadowing dart:async TimeoutError.)
APICallError
Provider API call failed (AI SDK APICallError analogue) — every HTTP-shaped failure. status is the classification (401 auth, 404 model, 429 rate limit + retryMs); -1 means no response arrived (transport).
InvalidArgumentError
Invalid argument (null args, invalid or expired handles, …).
InvalidPromptError
Invalid prompt.
InvalidResponseDataError
Invalid / malformed response data (streaming or decode failure).
JSONParseError
JSON parse / serialize failure.
NoSuchModelError
No such model in registry / catalogue.
NoSuchProviderError
No such provider name.
OtherError
Unclassified failure (AIMUX_E_OTHER).
RequestAbortedError
Request aborted (not DOM AbortError).
TokenExpiredError
Access token expired.
ToolError
Tool-related failure.
UnknownError
Unclassified / unknown failure (C AIMUX_E_UNKNOWN).
UnsupportedFunctionalityError
Unsupported functionality.