pub enum SdkError {
Backend(BackendError),
BackendContext {
source: BackendError,
context: String,
},
Engine(Box<EngineError>),
Config {
context: String,
field: Option<String>,
message: String,
},
WorkerAtCapacity,
Http {
source: Error,
context: String,
},
AdminApi {
status: u16,
message: String,
kind: Option<String>,
retryable: Option<bool>,
raw_body: String,
},
}Expand description
SDK error type.
Variants§
Backend(BackendError)
Backend transport error. Previously wrapped ferriskey::Error
directly (#88); now carries a backend-agnostic
BackendError so consumers match on
BackendErrorKind instead of ferriskey’s native taxonomy.
The ferriskey → BackendError mapping lives in
ff_backend_valkey::backend_error::backend_error_from_ferriskey.
BackendContext
Backend error with additional context (e.g. call-site label).
Previously ValkeyContext { source: ferriskey::Error } (#88).
Engine(Box<EngineError>)
FlowFabric engine error — typed sum over Lua error codes + transport
faults. See EngineError for the variant-granularity contract.
Replaces the previous Script(ScriptError) carrier (#58.6).
Boxed to keep SdkError’s stack footprint small: the richest
variant (ConflictKind::DependencyAlreadyExists { existing: EdgeSnapshot }) is ~200 bytes. Boxing keeps Result<T, SdkError>
at the same width every other variant pays.
Config
Configuration error. context identifies the call site / logical
operation (e.g. "describe_execution: exec_core", "admin_client").
field names the specific offending field when the error is
field-scoped (e.g. Some("public_state")), or None for
whole-object validation (e.g. "at least one lane is required").
message carries dynamic detail: source-error rendering, the
offending raw value, etc.
WorkerAtCapacity
Worker is at its configured max_concurrent_tasks capacity —
the caller should retry later. Returned by
FlowFabricWorker::claim_from_grant and
FlowFabricWorker::claim_from_reclaim_grant when the
concurrency semaphore is saturated. Distinct from Ok(None):
a ClaimGrant/ReclaimGrant represents real work already
selected by the scheduler, so silently dropping it would waste
the grant and let the grant TTL elapse. Surfacing the
saturation lets the caller release the grant (or wait +
retry).
§Classification
SdkError::is_retryablereturnstrue— saturation is transient: any in-flight task’s complete/fail/cancel/drop releases a permit. Retry after milliseconds, not a retry loop with backoff for a backend transport failure.SdkError::backend_kindreturnsNone— this is not a backend transport error, so there is noBackendErrorKindto inspect. Callers that fan out onbackend_kind()should matchWorkerAtCapacityexplicitly (or useis_retryable()).
Http
HTTP transport error from the admin REST surface. Carries
the underlying reqwest::Error via #[source] so callers
can inspect is_timeout() / is_connect() / etc. for
finer-grained retry logic. Distinct from
SdkError::Backend — this fires on the HTTP/JSON surface,
not on the Lua/Valkey hot path.
AdminApi
The admin REST endpoint returned a non-2xx response.
Fields surface the server-side ErrorBody JSON shape
({ error, kind?, retryable? }) as structured values so
cairn-fabric and other consumers can match without
re-parsing the body:
status— HTTP status code.message— theerrorstring from the JSON body (or the raw body if it didn’t parse as JSON).kind— server-supplied ValkeyErrorKindlabel for 5xxs backed by a transport error;Nonefor 4xxs.retryable— server-supplied hint;Nonefor 4xxs.raw_body— the full response body, preserved for logging when the JSON shape doesn’t match.
Implementations§
Source§impl SdkError
impl SdkError
Sourcepub fn backend_kind(&self) -> Option<BackendErrorKind>
pub fn backend_kind(&self) -> Option<BackendErrorKind>
Returns the classified BackendErrorKind if this error
carries a backend transport fault. Covers the direct
SdkError::Backend / SdkError::BackendContext variants
and Engine(EngineError::Transport { .. }) via the
ScriptError-aware downcast in ff_script::engine_error_ext.
Renamed from valkey_kind in #88 — the previous return type
Option<ferriskey::ErrorKind> leaked ferriskey into every
consumer doing retry classification.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether this error is safely retryable by a caller. For backend
transport variants, delegates to
BackendErrorKind::is_retryable. For Engine errors, returns
true iff the typed classification is
ErrorClass::Retryable. Config errors are never retryable.
Trait Implementations§
Source§impl Error for SdkError
impl Error for SdkError
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<BackendError> for SdkError
impl From<BackendError> for SdkError
Source§fn from(source: BackendError) -> Self
fn from(source: BackendError) -> Self
Source§impl From<EngineError> for SdkError
impl From<EngineError> for SdkError
Source§fn from(err: EngineError) -> Self
fn from(err: EngineError) -> Self
Source§impl From<Error> for SdkError
Available on crate feature valkey-default only.Lift a native ferriskey::Error into SdkError::Backend via
ff_backend_valkey::backend_error_from_ferriskey (#88). Keeps
?-propagation ergonomic at FCALL/transport call sites while
the public variant stays backend-agnostic.
impl From<Error> for SdkError
valkey-default only.Lift a native ferriskey::Error into SdkError::Backend via
ff_backend_valkey::backend_error_from_ferriskey (#88). Keeps
?-propagation ergonomic at FCALL/transport call sites while
the public variant stays backend-agnostic.
Source§impl From<ScriptError> for SdkError
Preserves the ergonomic ?-propagation from FCALL sites that
return Result<_, ScriptError>. Routes through EngineError’s
typed classification so every call site gets the same
variant-level detail without hand-written conversion.
impl From<ScriptError> for SdkError
Preserves the ergonomic ?-propagation from FCALL sites that
return Result<_, ScriptError>. Routes through EngineError’s
typed classification so every call site gets the same
variant-level detail without hand-written conversion.
Source§fn from(err: ScriptError) -> Self
fn from(err: ScriptError) -> Self
Auto Trait Implementations§
impl Freeze for SdkError
impl !RefUnwindSafe for SdkError
impl Send for SdkError
impl Sync for SdkError
impl Unpin for SdkError
impl UnsafeUnpin for SdkError
impl !UnwindSafe for SdkError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.