pub struct ErrorContext {
pub field_path: Option<String>,
pub details: Option<String>,
pub source: Option<String>,
pub hint: Option<String>,
pub request_id: Option<String>,
pub status_code: Option<u16>,
pub error_code: Option<String>,
pub retryable: Option<bool>,
pub fallbackable: Option<bool>,
}Expand description
Structured error context for better error handling and debugging.
Fields§
§field_path: Option<String>Field path or configuration key that caused the error (e.g., “manifest.base_url”, “request.messages[0].content”)
details: Option<String>Additional context about the error (e.g., expected type, actual value)
source: Option<String>Source of the error (e.g., “protocol_loader”, “request_validator”)
hint: Option<String>Actionable hint or suggestion for the user
request_id: Option<String>Request identifiers for tracking
status_code: Option<u16>HTTP status code if applicable
error_code: Option<String>Provider-specific error code
retryable: Option<bool>Flag indicating if the error is retryable
fallbackable: Option<bool>Flag indicating if the error should trigger a fallback
Implementations§
Source§impl ErrorContext
impl ErrorContext
pub fn new() -> Self
pub fn with_field_path(self, path: impl Into<String>) -> Self
pub fn with_details(self, details: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_hint(self, hint: impl Into<String>) -> Self
pub fn with_request_id(self, id: impl Into<String>) -> Self
pub fn with_status_code(self, code: u16) -> Self
pub fn with_error_code(self, code: impl Into<String>) -> Self
pub fn with_retryable(self, retryable: bool) -> Self
pub fn with_fallbackable(self, fallbackable: bool) -> Self
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 · 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 Default for ErrorContext
impl Default for ErrorContext
Source§impl PartialEq for ErrorContext
impl PartialEq for ErrorContext
impl Eq for ErrorContext
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.