pub trait ErrorStacks<C>{
// Required methods
fn err_code(&self) -> Option<&C>;
fn with_err_code(self, code: C) -> Self;
fn with_no_err_code(self) -> Self;
fn err_uri(&self) -> Option<&str>;
fn with_err_uri(self, uri: String) -> Self;
fn with_no_err_uri(self) -> Self;
fn with_err_msg(self, error: impl Display + Send + Sync + 'static) -> Self;
fn with_no_err_msg(self) -> Self;
fn stack_err(self) -> Self;
fn stack_err_msg(self, error: impl Display + Send + Sync + 'static) -> Self;
}
Expand description
Trait for stacking errors: errors that stack and provide an optional error code and resource URI for runtime error handling.
Required Methods§
Sourcefn with_err_code(self, code: C) -> Self
fn with_err_code(self, code: C) -> Self
Set the error code.
Sourcefn with_no_err_code(self) -> Self
fn with_no_err_code(self) -> Self
Remove the error code.
Sourcefn with_err_uri(self, uri: String) -> Self
fn with_err_uri(self, uri: String) -> Self
Set the error URI.
Sourcefn with_no_err_uri(self) -> Self
fn with_no_err_uri(self) -> Self
Remove the error URI.
Sourcefn with_err_msg(self, error: impl Display + Send + Sync + 'static) -> Self
fn with_err_msg(self, error: impl Display + Send + Sync + 'static) -> Self
Set the error message.
Sourcefn with_no_err_msg(self) -> Self
fn with_no_err_msg(self) -> Self
Remove the error message.
Sourcefn stack_err_msg(self, error: impl Display + Send + Sync + 'static) -> Self
fn stack_err_msg(self, error: impl Display + Send + Sync + 'static) -> Self
Stack a new error on the current one with a given message.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<T, E, C> ErrorStacks<C> for Result<T, E>
Implementation for Result
allows adding error codes on results.
impl<T, E, C> ErrorStacks<C> for Result<T, E>
Implementation for Result
allows adding error codes on results.