use thiserror::Error; /// Represents common errors that can occur across various HTTP handlers. #[derive(Debug, Error)] pub(crate) enum CommonError { /// Error when a handle slug is invalid. /// /// This error occurs when a URL contains a handle slug that doesn't conform /// to the expected format or contains invalid characters. #[error("error-smokesignal-common-1 Invalid handle slug")] InvalidHandleSlug, /// Error when a user lacks permission for an action. /// /// This error occurs when a user attempts to perform an action they /// are not authorized to do, such as modifying another user's data. #[error("error-smokesignal-common-2 Not authorized to perform this action")] NotAuthorized, /// Error when a required field is missing. /// /// This error occurs when a form or request is missing a mandatory field /// that is needed to complete the operation. #[error("error-smokesignal-common-3 Required field not provided")] FieldRequired, /// Error when event data has an invalid format or is corrupted. /// /// This error occurs when event data doesn't match the expected format /// or appears to be corrupted or tampered with. #[error("error-smokesignal-common-4 Invalid event format or corrupted data")] InvalidEventFormat, /// Error when a record update fails due to a concurrent modification. /// /// This error occurs when attempting to update a record but the record /// has been modified by another request since it was last read (CAS failure). #[error( "error-smokesignal-common-6 The record has been modified by another request. Please refresh and try again." )] InvalidSwap, }