pub struct ErrorEnvelope {
pub category: ErrorCategory,
pub severity: ErrorSeverity,
pub recoverable: bool,
pub code: String,
pub message: String,
pub hint: Option<String>,
}Expand description
Unified envelope used when crossing subsystem boundaries.
Fields§
§category: ErrorCategory§severity: ErrorSeverity§recoverable: bool§code: String§message: String§hint: Option<String>Actionable user hint (HTTP error.hint, TUI status line).
Implementations§
Source§impl ErrorEnvelope
impl ErrorEnvelope
pub fn new( category: ErrorCategory, severity: ErrorSeverity, recoverable: bool, code: impl Into<String>, message: impl Into<String>, ) -> Self
Sourcepub fn is_network_retryable(&self) -> bool
pub fn is_network_retryable(&self) -> bool
Whether stream/turn outer retries should consume budget for this envelope (A3.2).
Sourcepub fn to_wire_error_body(&self, http_status: u16) -> Value
pub fn to_wire_error_body(&self, http_status: u16) -> Value
JSON body for HTTP ApiError and desktop clients (error object).
Sourcepub fn transient(message: impl Into<String>) -> Self
pub fn transient(message: impl Into<String>) -> Self
Recoverable internal error — stream stalls, transient retries, generic
engine errors that the user can resolve by retrying. Severity is
Warning so the UI surfaces it in amber rather than red.
Sourcepub fn fatal(message: impl Into<String>) -> Self
pub fn fatal(message: impl Into<String>) -> Self
Non-recoverable internal error — missing client, spawn failure, etc. Flips the session into offline mode.
Sourcepub fn fatal_auth(message: impl Into<String>) -> Self
pub fn fatal_auth(message: impl Into<String>) -> Self
Authentication failure — fatal and blocks the session.
Sourcepub fn context_overflow(message: impl Into<String>) -> Self
pub fn context_overflow(message: impl Into<String>) -> Self
Context length / overflow — invalid input, recoverable via /compact.
Trait Implementations§
Source§impl Clone for ErrorEnvelope
impl Clone for ErrorEnvelope
Source§fn clone(&self) -> ErrorEnvelope
fn clone(&self) -> ErrorEnvelope
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 ErrorEnvelope
impl Debug for ErrorEnvelope
Source§impl<'de> Deserialize<'de> for ErrorEnvelope
impl<'de> Deserialize<'de> for ErrorEnvelope
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ErrorEnvelope
impl Display for ErrorEnvelope
Source§impl Error for ErrorEnvelope
impl Error for ErrorEnvelope
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 From<ToolError> for ErrorEnvelope
impl From<ToolError> for ErrorEnvelope
Auto Trait Implementations§
impl Freeze for ErrorEnvelope
impl RefUnwindSafe for ErrorEnvelope
impl Send for ErrorEnvelope
impl Sync for ErrorEnvelope
impl Unpin for ErrorEnvelope
impl UnsafeUnpin for ErrorEnvelope
impl UnwindSafe for ErrorEnvelope
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