pub enum GenericErrorCode {
InternalError,
ValidationFailed,
NotFound,
Conflict,
Unauthorized,
Forbidden,
Gone,
}Expand description
Generic error codes for common scenarios.
Use these when a domain-specific error code is not available.
Variants§
Trait Implementations§
Source§impl Clone for GenericErrorCode
impl Clone for GenericErrorCode
Source§fn clone(&self) -> GenericErrorCode
fn clone(&self) -> GenericErrorCode
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 CqrsErrorCode for GenericErrorCode
impl CqrsErrorCode for GenericErrorCode
Source§fn domain_prefix() -> u16
fn domain_prefix() -> u16
Domain prefix for internal codes (0-9)
Each domain gets a unique prefix.
Source§fn error_index(&self) -> u16
fn error_index(&self) -> u16
Unique error index within the domain (0-999)
Source§fn http_status(&self) -> StatusCode
fn http_status(&self) -> StatusCode
HTTP status code for this error
Source§fn internal_code(&self) -> u16
fn internal_code(&self) -> u16
Full internal code: domain_prefix * 1000 + error_index
Example: Tenant (4) + NotFound (1) = 4001
Source§fn code_string(&self) -> String
fn code_string(&self) -> String
String representation of the error code for JSON serialization
Format: DOMAIN_ERROR_NAME (e.g., “PLAN_NOT_FOUND”)
Source§impl Debug for GenericErrorCode
impl Debug for GenericErrorCode
Source§impl Display for GenericErrorCode
impl Display for GenericErrorCode
Source§impl Error for GenericErrorCode
impl Error for GenericErrorCode
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<StatusCode> for GenericErrorCode
impl From<StatusCode> for GenericErrorCode
Source§fn from(status: StatusCode) -> Self
fn from(status: StatusCode) -> Self
Converts to this type from the input type.
Source§impl PartialEq for GenericErrorCode
impl PartialEq for GenericErrorCode
Source§fn eq(&self, other: &GenericErrorCode) -> bool
fn eq(&self, other: &GenericErrorCode) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for GenericErrorCode
impl Eq for GenericErrorCode
impl StructuralPartialEq for GenericErrorCode
Auto Trait Implementations§
impl Freeze for GenericErrorCode
impl RefUnwindSafe for GenericErrorCode
impl Send for GenericErrorCode
impl Sync for GenericErrorCode
impl Unpin for GenericErrorCode
impl UnsafeUnpin for GenericErrorCode
impl UnwindSafe for GenericErrorCode
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