i18n+filtering fork - fluent-templates v2
at main 68 lines 2.6 kB view raw
1use thiserror::Error; 2 3/// Represents common errors that can occur across various HTTP handlers. 4#[derive(Debug, Error)] 5pub 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-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-common-2 Not authorized to perform this action")] 18 NotAuthorized, 19 20 /// Error when an unsupported event type is encountered. 21 /// 22 /// This error occurs when an operation is attempted on an event type 23 /// that is not supported by the current functionality. 24 #[error("error-common-3 Unsupported event type")] 25 UnsupportedEventType, 26 27 /// Error when a required field is missing. 28 /// 29 /// This error occurs when a form or request is missing a mandatory field 30 /// that is needed to complete the operation. 31 #[error("error-common-4 Required field not provided")] 32 FieldRequired, 33 34 /// Error when data has an invalid format or is corrupted. 35 /// 36 /// This error occurs when input data doesn't match the expected format 37 /// or appears to be corrupted or tampered with. 38 #[error("error-common-5 Invalid format or corrupted data")] 39 InvalidFormat, 40 41 /// Error when an AT Protocol URI has an invalid format. 42 /// 43 /// This error occurs when an AT Protocol URI is malformed or 44 /// doesn't follow the expected format specification. 45 #[error("error-common-6 Invalid AT-URI format")] 46 InvalidAtUri, 47 48 /// Error when a requested record cannot be found. 49 /// 50 /// This error occurs when an operation is attempted on a record 51 /// that doesn't exist in the database. 52 #[error("error-common-7 Record not found")] 53 RecordNotFound, 54 55 /// Error when record data cannot be parsed. 56 /// 57 /// This error occurs when a record's data cannot be properly 58 /// deserialized or parsed into the expected structure. 59 #[error("error-common-8 Failed to parse record data")] 60 FailedToParse, 61 62 /// Error when event data has an invalid format or is corrupted. 63 /// 64 /// This error occurs when event data doesn't match the expected format 65 /// or appears to be corrupted or tampered with. 66 #[error("error-common-9 Invalid event format or corrupted data")] 67 InvalidEventFormat, 68}