Something went wrong. Try again.
The smokesignal.events web application
Something went wrong. Try again.
3.1 kB · 79 lines
Rust
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980use thiserror::Error;
/// Represents errors that can occur during LFG (Looking For Group) operations.////// These errors are typically triggered during validation of user-submitted/// LFG creation forms or during LFG record operations.#[derive(Debug, Error)]pub(crate) enum LfgError { /// Error when the location is not provided. /// /// This error occurs when a user attempts to create an LFG record without /// selecting a location on the map. #[error("error-smokesignal-lfg-1 Location not set")] LocationNotSet,
/// Error when the coordinates are invalid. /// /// This error occurs when the provided latitude or longitude /// values are not valid numbers or are out of range. #[error("error-smokesignal-lfg-2 Invalid coordinates: {0}")] InvalidCoordinates(String),
/// Error when no tags are provided. /// /// This error occurs when a user attempts to create an LFG record without /// specifying at least one interest tag. #[error("error-smokesignal-lfg-3 Tags required (at least one)")] TagsRequired,
/// Error when too many tags are provided. /// /// This error occurs when a user attempts to create an LFG record with /// more than the maximum allowed number of tags (10). #[error("error-smokesignal-lfg-4 Too many tags (maximum 10)")] TooManyTags,
/// Error when an invalid duration is specified. /// /// This error occurs when the provided duration value is not one of /// the allowed options (6, 12, 24, 48, or 72 hours). #[error("error-smokesignal-lfg-5 Invalid duration")] InvalidDuration,
/// Error when the PDS record creation fails. /// /// This error occurs when the AT Protocol server returns an error /// during LFG record creation. #[error("error-smokesignal-lfg-6 Failed to create PDS record: {message}")] PdsRecordCreationFailed { message: String },
/// Error when no active LFG record is found. /// /// This error occurs when attempting to perform operations that /// require an active LFG record (e.g., deactivation, viewing matches). #[error("error-smokesignal-lfg-7 No active LFG record found")] NoActiveRecord,
/// Error when user already has an active LFG record. /// /// This error occurs when a user attempts to create a new LFG record /// while they already have an active one. Users must deactivate their /// existing record before creating a new one. #[error("error-smokesignal-lfg-8 Active LFG record already exists")] ActiveRecordExists,
/// Error when deactivation fails. /// /// This error occurs when the attempt to deactivate an LFG record /// fails due to a server or network error. #[error("error-smokesignal-lfg-9 Failed to deactivate LFG record: {message}")] DeactivationFailed { message: String },
/// Error when a tag is invalid. /// /// This error occurs when a provided tag is empty or exceeds /// the maximum allowed length. #[error("error-smokesignal-lfg-10 Invalid tag: {0}")] InvalidTag(String),}