The smokesignal.events web application
at main 42 lines 1.7 kB view raw
1use thiserror::Error; 2 3/// Represents common errors that can occur across various HTTP handlers. 4#[derive(Debug, Error)] 5pub(crate) enum CommonError { 6 /// Error when a handle slug is invalid. 7 /// 8 /// This error occurs when a URL contains a handle slug that doesn't conform 9 /// to the expected format or contains invalid characters. 10 #[error("error-smokesignal-common-1 Invalid handle slug")] 11 InvalidHandleSlug, 12 13 /// Error when a user lacks permission for an action. 14 /// 15 /// This error occurs when a user attempts to perform an action they 16 /// are not authorized to do, such as modifying another user's data. 17 #[error("error-smokesignal-common-2 Not authorized to perform this action")] 18 NotAuthorized, 19 20 /// Error when a required field is missing. 21 /// 22 /// This error occurs when a form or request is missing a mandatory field 23 /// that is needed to complete the operation. 24 #[error("error-smokesignal-common-3 Required field not provided")] 25 FieldRequired, 26 27 /// Error when event data has an invalid format or is corrupted. 28 /// 29 /// This error occurs when event data doesn't match the expected format 30 /// or appears to be corrupted or tampered with. 31 #[error("error-smokesignal-common-4 Invalid event format or corrupted data")] 32 InvalidEventFormat, 33 34 /// Error when a record update fails due to a concurrent modification. 35 /// 36 /// This error occurs when attempting to update a record but the record 37 /// has been modified by another request since it was last read (CAS failure). 38 #[error( 39 "error-smokesignal-common-6 The record has been modified by another request. Please refresh and try again." 40 )] 41 InvalidSwap, 42}