pub enum Error<E> {
Original(E),
Keel(OutcomeError),
}Expand description
The error a #[keel::wrap]-wrapped function or crate::KeelMiddleware
surfaces.
Original is your own code’s error, unchanged, from the attempt the
engine actually ran last (DX invariant 5’s “re-raise the original
exception unchanged”, ported to a typed enum since Rust has no untyped
exceptions to re-raise). Keel is a judgment the engine made without
ever calling your code: a circuit breaker fast-fail (KEEL-E012), a rate
budget rejection (KEEL-E013), or a non-idempotent call correctly left
un-retried (KEEL-E014) — see contracts/error-codes.json for the full
taxonomy.
Variants§
Original(E)
Your code/library’s own error from the last attempt.
Keel(OutcomeError)
A judgment the engine made without calling your code.
Implementations§
Source§impl<E> Error<E>
impl<E> Error<E>
Sourcepub const fn code(&self) -> Option<ErrorCode>
pub const fn code(&self) -> Option<ErrorCode>
The KEEL-E0NN code the engine assigned, if this is a Error::Keel
judgment rather than your own code’s Error::Original error.
Sourcepub fn into_original(self) -> Option<E>
pub fn into_original(self) -> Option<E>
Recover your code/library’s original error, if this wraps one — an engine judgment made without ever calling your code has none to give back.
Trait Implementations§
Source§impl<E: Debug + Display> Error for Error<E>
impl<E: Debug + Display> Error for Error<E>
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()