pub struct ErrorContext {
pub code: ErrorCode,
pub decision_chain: DecisionChain,
pub retryable: bool,
pub remediation: &'static str,
}Expand description
The structured context attached to every request-path error.
Fields§
§code: ErrorCodeThe stable error code.
decision_chain: DecisionChainThe decision chain leading to the failure (ids/shapes only).
retryable: boolWhether the caller may retry (possibly after re-resolving).
remediation: &'static strA short, actionable hint for an operator or LLM.
Implementations§
Source§impl ErrorContext
impl ErrorContext
Sourcepub fn new(code: ErrorCode, retryable: bool, remediation: &'static str) -> Self
pub fn new(code: ErrorCode, retryable: bool, remediation: &'static str) -> Self
Builds a context for code with an empty decision chain. Stages enrich
the chain via ErrorContext::with_chain as context becomes available.
Sourcepub fn with_chain(self, chain: DecisionChain) -> Self
pub fn with_chain(self, chain: DecisionChain) -> Self
Attaches a decision chain (builder style).
Trait Implementations§
Source§impl Clone for ErrorContext
impl Clone for ErrorContext
Source§fn clone(&self) -> ErrorContext
fn clone(&self) -> ErrorContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorContext
impl Debug for ErrorContext
Source§impl Display for ErrorContext
impl Display for ErrorContext
impl Eq for ErrorContext
Source§impl Error for ErrorContext
impl Error for ErrorContext
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for ErrorContext
impl PartialEq for ErrorContext
Source§fn eq(&self, other: &ErrorContext) -> bool
fn eq(&self, other: &ErrorContext) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ErrorContext
Auto Trait Implementations§
impl Freeze for ErrorContext
impl RefUnwindSafe for ErrorContext
impl Send for ErrorContext
impl Sync for ErrorContext
impl Unpin for ErrorContext
impl UnsafeUnpin for ErrorContext
impl UnwindSafe for ErrorContext
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
Mutably borrows from an owned value. Read more