#[non_exhaustive]pub enum ProductError {
NotFound(Uuid),
VariantNotFound(Uuid),
DuplicateSlug(String),
NotPurchasable,
Other(Box<dyn Error + Send + Sync>),
}Expand description
Errors specific to product operations.
§Example
use stateset_core::errors::ProductError;
let err = ProductError::not_found(uuid::Uuid::nil());
assert!(err.to_string().contains("not found"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
NotFound(Uuid)
Product with the given ID was not found.
VariantNotFound(Uuid)
Product variant with the given ID was not found.
DuplicateSlug(String)
Duplicate product slug already exists.
NotPurchasable
Product is not available for purchase.
Other(Box<dyn Error + Send + Sync>)
Extensibility.
Implementations§
Source§impl ProductError
impl ProductError
Sourcepub const fn variant_not_found(id: Uuid) -> Self
pub const fn variant_not_found(id: Uuid) -> Self
Convenience constructor for VariantNotFound.
Sourcepub fn duplicate_slug(slug: impl Into<String>) -> Self
pub fn duplicate_slug(slug: impl Into<String>) -> Self
Convenience constructor for DuplicateSlug.
Trait Implementations§
Source§impl Debug for ProductError
impl Debug for ProductError
Source§impl Display for ProductError
impl Display for ProductError
Source§impl Error for ProductError
impl Error for ProductError
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<ProductError> for CommerceError
impl From<ProductError> for CommerceError
Source§fn from(source: ProductError) -> Self
fn from(source: ProductError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for ProductError
impl !UnwindSafe for ProductError
impl Freeze for ProductError
impl Send for ProductError
impl Sync for ProductError
impl Unpin for ProductError
impl UnsafeUnpin for ProductError
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