The smokesignal.events web application
at main 190 lines 8.0 kB view raw
1use thiserror::Error; 2 3/// Represents errors that can occur during RSVP acceptance operations. 4/// 5/// These errors typically occur during the acceptance workflow, including 6/// ticket creation, validation, and acceptance record management. 7#[derive(Debug, Error)] 8pub(crate) enum AcceptanceError { 9 /// Error when retrieving an acceptance ticket fails. 10 /// 11 /// This error occurs when a database query for an acceptance ticket 12 /// fails due to connectivity or query issues. 13 #[error("error-smokesignal-acceptance-1 Failed to get acceptance ticket: {0}")] 14 TicketGetFailed(String), 15 16 /// Error when an acceptance ticket is not found. 17 /// 18 /// This error occurs when attempting to retrieve an acceptance ticket 19 /// that doesn't exist in the database. 20 #[error("error-smokesignal-acceptance-2 Acceptance ticket not found")] 21 TicketNotFound, 22 23 /// Error when retrieving the latest acceptance ticket fails. 24 /// 25 /// This error occurs when querying for the most recent acceptance ticket 26 /// fails due to database issues. 27 #[error("error-smokesignal-acceptance-3 Failed to get latest acceptance ticket: {0}")] 28 LatestTicketGetFailed(String), 29 30 /// Error when retrieving an RSVP for validation fails. 31 /// 32 /// This error occurs when querying for an RSVP record during the 33 /// acceptance validation process fails. 34 #[error("error-smokesignal-acceptance-4 Failed to get RSVP for validation: {0}")] 35 RsvpGetFailed(String), 36 37 /// Error when an RSVP is not found. 38 /// 39 /// This error occurs when attempting to retrieve an RSVP record 40 /// that doesn't exist in the database. 41 #[error("error-smokesignal-acceptance-5 RSVP not found")] 42 RsvpNotFound, 43 44 /// Error when an acceptance AT-URI is invalid. 45 /// 46 /// This error occurs when attempting to parse an AT-URI for an 47 /// acceptance record that is malformed or invalid. 48 #[error("error-smokesignal-acceptance-6 Invalid acceptance AT-URI: {0}")] 49 InvalidAcceptanceAtUri(String), 50 51 /// Error when resolving the organizer's DID fails. 52 /// 53 /// This error occurs when DID resolution for the event organizer 54 /// fails during the acceptance workflow. 55 #[error("error-smokesignal-acceptance-7 Failed to resolve organizer DID: {0}")] 56 OrganizerDidResolveFailed(String), 57 58 /// Error when the organizer has no PDS endpoint. 59 /// 60 /// This error occurs when the organizer's DID document doesn't contain 61 /// any PDS endpoints, preventing acceptance record creation. 62 #[error("error-smokesignal-acceptance-8 Organizer has no PDS endpoint")] 63 OrganizerNoPdsEndpoint, 64 65 /// Error when retrieving an acceptance record from AT Protocol fails. 66 /// 67 /// This error occurs when fetching an acceptance record from the 68 /// organizer's PDS fails. 69 #[error("error-smokesignal-acceptance-9 Failed to get acceptance record: {0}")] 70 AcceptanceRecordGetFailed(String), 71 72 /// Error when deserializing an RSVP record fails. 73 /// 74 /// This error occurs when attempting to parse RSVP record JSON data 75 /// that is malformed or invalid. 76 #[error("error-smokesignal-acceptance-10 Failed to deserialize RSVP record: {0}")] 77 RsvpDeserializeFailed(String), 78 79 /// Error when appending a remote attestation fails. 80 /// 81 /// This error occurs when adding an attestation to an RSVP record 82 /// fails during the acceptance workflow. 83 #[error("error-smokesignal-acceptance-12 Failed to append remote attestation: {0}")] 84 AttestationAppendFailed(String), 85 86 /// Error when an RSVP AT-URI is invalid. 87 /// 88 /// This error occurs when attempting to parse an AT-URI for an RSVP 89 /// record that is malformed or invalid. 90 #[error("error-smokesignal-acceptance-13 Invalid RSVP AT-URI: {0}")] 91 InvalidRsvpAtUri(String), 92 93 /// Error when updating an RSVP via AT Protocol fails. 94 /// 95 /// This error occurs when the AT Protocol putRecord operation fails 96 /// when updating an RSVP with acceptance information. 97 #[error("error-smokesignal-acceptance-14 AT Protocol error updating RSVP: {0}")] 98 RsvpUpdateAtProtocolFailed(String), 99 100 /// Error when updating an RSVP fails. 101 /// 102 /// This error occurs when a generic error happens during RSVP update 103 /// that isn't specifically an AT Protocol error. 104 #[error("error-smokesignal-acceptance-15 Failed to update RSVP: {0}")] 105 RsvpUpdateFailed(String), 106 107 /// Error when updating the RSVP validated_at timestamp fails. 108 /// 109 /// This error occurs when updating the database to mark an RSVP as 110 /// validated fails. 111 #[error("error-smokesignal-acceptance-16 Failed to update RSVP validated_at: {0}")] 112 RsvpValidatedAtUpdateFailed(String), 113 114 /// Error when deleting an acceptance ticket fails. 115 /// 116 /// This error occurs when removing a processed acceptance ticket 117 /// from the database fails. 118 #[error("error-smokesignal-acceptance-17 Failed to delete acceptance ticket: {0}")] 119 TicketDeleteFailed(String), 120 121 /// Error when serializing acceptance data fails. 122 /// 123 /// This error occurs when converting acceptance data to JSON format 124 /// fails during record creation. 125 #[error("error-smokesignal-acceptance-19 Failed to serialize acceptance: {0}")] 126 AcceptanceSerializeFailed(String), 127 128 /// Error when creating a remote attestation proof fails. 129 /// 130 /// This error occurs when generating a cryptographic proof for 131 /// remote attestation fails. 132 #[error("error-smokesignal-acceptance-20 Failed to create remote attestation proof: {0}")] 133 AttestationProofCreateFailed(String), 134 135 /// Error when the AT Protocol putRecord operation returns an error. 136 /// 137 /// This error occurs when creating an acceptance record via AT Protocol 138 /// fails with an error response from the PDS. 139 #[error("error-smokesignal-acceptance-21 AT Protocol putRecord failed: {0}")] 140 PutRecordFailed(String), 141 142 /// Error when storing an acceptance ticket fails. 143 /// 144 /// This error occurs when saving a new acceptance ticket to the 145 /// database fails. 146 #[error("error-smokesignal-acceptance-22 Failed to store acceptance ticket: {0}")] 147 TicketStoreFailed(String), 148 149 /// Error when deleting an acceptance record fails. 150 /// 151 /// This error occurs when removing an acceptance record from the 152 /// database fails during unacceptance operations. 153 #[error("error-smokesignal-acceptance-23 Failed to delete acceptance record: {0}")] 154 AcceptanceRecordDeleteFailed(String), 155 156 /// Error when clearing the RSVP validated_at timestamp fails. 157 /// 158 /// This error occurs when resetting the validated_at field during 159 /// unacceptance operations fails. 160 #[error("error-smokesignal-acceptance-24 Failed to clear RSVP validated_at: {0}")] 161 RsvpValidatedAtClearFailed(String), 162 163 /// Error when the AT Protocol deleteRecord operation fails. 164 /// 165 /// This error occurs when deleting an acceptance record via AT Protocol 166 /// fails with an error response from the PDS. 167 #[error("error-smokesignal-acceptance-25 AT Protocol deleteRecord failed: {0}")] 168 DeleteRecordFailed(String), 169 170 /// Error when user is not authorized to perform the operation. 171 /// 172 /// This error occurs when a user attempts to perform an acceptance 173 /// operation they don't have permission for. 174 #[error("error-smokesignal-acceptance-26 Not authorized")] 175 NotAuthorized, 176 177 /// Error when retrieving the event fails. 178 /// 179 /// This error occurs when querying for the event record during 180 /// external attestation processing fails. 181 #[error("error-smokesignal-acceptance-27 Failed to get event: {0}")] 182 EventGetFailed(String), 183 184 /// Error when inserting a new RSVP fails. 185 /// 186 /// This error occurs when creating a new RSVP record during 187 /// external attestation processing fails. 188 #[error("error-smokesignal-acceptance-28 Failed to insert RSVP: {0}")] 189 RsvpInsertFailed(String), 190}