pub enum AiMuxError {
Show 18 variants
Provider(String),
Http(String),
Json(String),
Stream(String),
Tool(String),
InvalidArgument(String),
InvalidPrompt(String),
RateLimited {
retry_after_ms: u64,
},
Auth(String),
TokenExpired(String),
ModelNotFound(String),
Unsupported(String),
NoSuchModel(String),
UnknownProvider(String),
ApiCall(String),
Timeout(String),
Aborted,
Other(String),
}Expand description
Unified error type for all aimux operations.
Variants§
Provider(String)
Http(String)
Json(String)
Stream(String)
Tool(String)
InvalidArgument(String)
InvalidPrompt(String)
RateLimited
Auth(String)
TokenExpired(String)
The access token has expired (or was invalidated) and must be refreshed
by the caller. RFC-0018 subscription mode: the library maps a 401 from
the Codex subscription endpoint to this variant; the integrator
orchestrates codex_refresh + retry.
ModelNotFound(String)
Unsupported(String)
NoSuchModel(String)
UnknownProvider(String)
ApiCall(String)
Timeout(String)
Aborted
Other(String)
Implementations§
Source§impl AiMuxError
impl AiMuxError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if the error is transient and can be retried.
Sourcepub fn retry_after_hint(&self) -> Option<i64>
pub fn retry_after_hint(&self) -> Option<i64>
Returns the retry-after delay hint (in milliseconds) carried by this
error, if any. Currently only RateLimited carries a hint (from a
retry-after-ms / retry-after response header). Returns None for
errors that don’t advertise a delay, in which case the retry strategy
falls back to exponential backoff.
Mirrors the header-consulting behaviour of
retryWithExponentialBackoffRespectingRetryHeaders in the TS SDK.
Sourcepub fn error_type(&self) -> &'static str
pub fn error_type(&self) -> &'static str
Returns the error variant name as a string (e.g. "Auth", "Provider",
"RateLimited"). Used by FFI bindings to give callers a machine-readable
error type alongside the human-readable message.
Sourcepub fn status_code(&self) -> Option<u16>
pub fn status_code(&self) -> Option<u16>
Returns the HTTP status code carried by this error, if any.
HTTP-layer errors created by parse_provider_error and
send_with_retry_raw embed the status code in the message as
"HTTP {status}: ...". This method extracts it. Errors that don’t
originate from an HTTP response return None.
Trait Implementations§
Source§impl Clone for AiMuxError
impl Clone for AiMuxError
Source§fn clone(&self) -> AiMuxError
fn clone(&self) -> AiMuxError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AiMuxError
impl Debug for AiMuxError
Source§impl<'de> Deserialize<'de> for AiMuxError
impl<'de> Deserialize<'de> for AiMuxError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for AiMuxError
impl Display for AiMuxError
Source§impl Error for AiMuxError
impl Error for AiMuxError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for AiMuxError
impl From<Error> for AiMuxError
Source§impl Serialize for AiMuxError
impl Serialize for AiMuxError
Source§impl TS for AiMuxError
impl TS for AiMuxError
Source§type WithoutGenerics = AiMuxError
type WithoutGenerics = AiMuxError
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that
EXPORT_TO must be None. Read moreSource§type OptionInnerType = AiMuxError
type OptionInnerType = AiMuxError
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
Source§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export. Read more