pub struct Error { /* private fields */ }Expand description
No raw body, credential, URL, transport source error, or upstream message is retained. Allowlisted problem fields and explicit application messages have separate getters.
Implementations§
Source§impl Error
impl Error
Sourcepub fn custom(
message: impl AsRef<str>,
error_type: Option<ErrorType>,
metadata: ErrorMetadata,
) -> Result<Self>
pub fn custom( message: impl AsRef<str>, error_type: Option<ErrorType>, metadata: ErrorMetadata, ) -> Result<Self>
Construct an application error with checked metadata and an explicit message. The message is bounded to 8 KiB and omitted from all ordinary formatting.
pub fn name(&self) -> &'static str
pub fn message(&self) -> Option<&str>
pub fn error_type(&self) -> Option<ErrorType>
pub fn problem(&self) -> Option<&ProblemDetails>
pub fn failure_kind(&self) -> Option<FailureKind>
pub fn metadata(&self) -> ErrorMetadata
Sourcepub fn capture_backtrace(self) -> Self
pub fn capture_backtrace(self) -> Self
Opt-in native stack capture. It is accessible only through the explicit getter.
pub fn backtrace(&self) -> Option<&Backtrace>
pub fn kind(&self) -> ErrorKind
pub fn status(&self) -> Option<u16>
pub fn operation(&self) -> Option<&'static str>
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Explicit access to an allowlisted correlation field; ordinary formatting redacts it.
Sourcepub fn service_code(&self) -> Option<&str>
pub fn service_code(&self) -> Option<&str>
Explicit access to the service code; ordinary formatting redacts it.
pub fn retry_after(&self) -> Option<Duration>
pub fn remote_outcome(&self) -> RemoteOutcome
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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<T> From<Error> for StreamCollectionError<T>
impl<T> From<Error> for StreamCollectionError<T>
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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