pub enum CommonError {
NotFound {
entity_type: &'static str,
id: String,
},
AlreadyExists {
entity_type: &'static str,
},
ValidationFailed {
message: String,
},
Unauthorized,
Forbidden {
message: String,
},
Internal {
message: String,
},
Conflict {
message: String,
},
}Expand description
Common module errors that can be reused.
Variants§
NotFound
Entity not found.
AlreadyExists
Duplicate entity.
ValidationFailed
Validation failed.
Unauthorized access.
Forbidden
Forbidden access.
Internal
Internal error.
Conflict
Conflict (e.g., version mismatch).
Trait Implementations§
Source§impl Debug for CommonError
impl Debug for CommonError
Source§impl Display for CommonError
impl Display for CommonError
Source§impl Error for CommonError
impl Error for CommonError
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 ModuleError for CommonError
impl ModuleError for CommonError
Source§fn error_code(&self) -> &str
fn error_code(&self) -> &str
Machine-readable error code. Read more
Source§fn status_code(&self) -> u16
fn status_code(&self) -> u16
HTTP status code for this error. Read more
Source§fn user_message(&self) -> &str
fn user_message(&self) -> &str
User-friendly error message. Read more
Source§fn is_retriable(&self) -> bool
fn is_retriable(&self) -> bool
Whether this error is retriable. Read more
Source§fn is_loggable(&self) -> bool
fn is_loggable(&self) -> bool
Whether this error should be logged at error level. Read more
Source§fn category(&self) -> ErrorCategory
fn category(&self) -> ErrorCategory
Error category for monitoring.
Auto Trait Implementations§
impl Freeze for CommonError
impl RefUnwindSafe for CommonError
impl Send for CommonError
impl Sync for CommonError
impl Unpin for CommonError
impl UnsafeUnpin for CommonError
impl UnwindSafe for CommonError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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