pub struct ApplicationError {
pub code: String,
pub message: String,
pub retryable: bool,
pub remediation: String,
pub details: Box<ApplicationErrorDetails>,
/* private fields */
}Expand description
Error type surfaced by the application layer, carrying a stable code, remediation guidance, and structured source-specific details.
Fields§
§code: StringStable, machine-readable error code.
message: StringHuman-readable, redacted description of the failure.
retryable: boolWhether retrying the operation might succeed.
remediation: StringSuggested remediation the caller can act on.
details: Box<ApplicationErrorDetails>Structured details describing where the error originated.
Implementations§
Source§impl ApplicationError
impl ApplicationError
Sourcepub fn new(
code: impl Into<String>,
message: impl Into<String>,
retryable: bool,
remediation: impl Into<String>,
) -> Self
pub fn new( code: impl Into<String>, message: impl Into<String>, retryable: bool, remediation: impl Into<String>, ) -> Self
Builds a generic ApplicationError from its core fields.
Sourcepub fn with_details(self, details: ApplicationErrorDetails) -> Self
pub fn with_details(self, details: ApplicationErrorDetails) -> Self
Attaches structured details and returns the updated error.
Sourcepub fn private_diagnostics(&self) -> Option<&str>
pub fn private_diagnostics(&self) -> Option<&str>
Returns the internal diagnostics, which are never serialized to callers.
Sourcepub fn service_error_kind(&self) -> Option<&str>
pub fn service_error_kind(&self) -> Option<&str>
Returns the service error kind when the error came from the service
layer, otherwise None.
Sourcepub fn is_validation(&self) -> bool
pub fn is_validation(&self) -> bool
Returns true when this error represents a validation failure.
Trait Implementations§
Source§impl Clone for ApplicationError
impl Clone for ApplicationError
Source§fn clone(&self) -> ApplicationError
fn clone(&self) -> ApplicationError
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 ApplicationError
impl Debug for ApplicationError
Source§impl Display for ApplicationError
impl Display for ApplicationError
Source§impl Error for ApplicationError
impl Error for ApplicationError
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<PortError> for ApplicationError
impl From<PortError> for ApplicationError
Source§impl From<ProviderError> for ApplicationError
impl From<ProviderError> for ApplicationError
Source§fn from(error: ProviderError) -> Self
fn from(error: ProviderError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ApplicationError
impl PartialEq for ApplicationError
Source§fn eq(&self, other: &ApplicationError) -> bool
fn eq(&self, other: &ApplicationError) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ApplicationError
impl Serialize for ApplicationError
impl Eq for ApplicationError
impl StructuralPartialEq for ApplicationError
Auto Trait Implementations§
impl Freeze for ApplicationError
impl RefUnwindSafe for ApplicationError
impl Send for ApplicationError
impl Sync for ApplicationError
impl Unpin for ApplicationError
impl UnsafeUnpin for ApplicationError
impl UnwindSafe for ApplicationError
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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