#[non_exhaustive]pub enum AppError {
Structured {
kind: ErrorKind,
message: String,
retry_after_secs: Option<u64>,
source: Option<Arc<dyn Error + Send + Sync>>,
},
}Expand description
Application error with structured kind for agents.
§Display
Prints only the technical English message field (lowercase, no trailing
period). Walk std::error::Error::source for the cause chain; do not
duplicate the cause text in message.
§Clone
Source is held in Arc so clones share the cause without re-boxing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Implementations§
Source§impl AppError
impl AppError
Sourcepub fn new(kind: ErrorKind, message: impl Into<String>) -> Self
pub fn new(kind: ErrorKind, message: impl Into<String>) -> Self
Build a structured error without a source chain.
§Errors
This constructor never fails; the returned value is the error itself.
Sourcepub fn with_source(
kind: ErrorKind,
message: impl Into<String>,
source: impl Error + Send + Sync + 'static,
) -> Self
pub fn with_source( kind: ErrorKind, message: impl Into<String>, source: impl Error + Send + Sync + 'static, ) -> Self
Build a structured error with a source chain (cause preserved).
The cause is available via std::error::Error::source and is not
duplicated in message.
Sourcepub fn with_retry_after(self, secs: u64) -> Self
pub fn with_retry_after(self, secs: u64) -> Self
Attach optional Retry-After seconds (HTTP 429 / 503).
Sourcepub fn interrupted() -> Self
pub fn interrupted() -> Self
SIGINT cancel.
Sourcepub fn terminated() -> Self
pub fn terminated() -> Self
SIGTERM cancel.
Sourcepub fn broken_pipe() -> Self
pub fn broken_pipe() -> Self
stdout closed by the reader (pipe consumer exited).
Sourcepub fn retry_after_secs(&self) -> Option<u64>
pub fn retry_after_secs(&self) -> Option<u64>
Returns optional Retry-After seconds when present.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Alias of Self::retryable (Rules Rust checklist name is_retryable).
Sourcepub fn is_permanent(&self) -> bool
pub fn is_permanent(&self) -> bool
Permanent for agent auto-retry (complement of Self::is_retryable).
Sourcepub fn retry_kind(&self) -> RetryKind
pub fn retry_kind(&self) -> RetryKind
Detailed retry category (Rules Rust checklist retry_kind).
Sourcepub fn from_http_status(status: u16, body_hint: &str) -> Self
pub fn from_http_status(status: u16, body_hint: &str) -> Self
Map remote HTTP status to a domain error.
body_hint must be a short, non-sensitive context label (e.g. endpoint
name or "retries exhausted"), never a raw response body or credential.
Trait Implementations§
Source§impl Error for AppError
impl Error for AppError
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()
Auto Trait Implementations§
impl !RefUnwindSafe for AppError
impl !UnwindSafe for AppError
impl Freeze for AppError
impl Send for AppError
impl Sync for AppError
impl Unpin for AppError
impl UnsafeUnpin for AppError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more