The smokesignal.events web application
at main 49 lines 2.2 kB view raw
1use thiserror::Error; 2 3/// Represents errors that can occur during user login and authentication. 4/// 5/// These errors typically happen during the authentication process when users 6/// are logging in to the application, including OAuth flows and DID validation. 7#[derive(Debug, Error)] 8pub(crate) enum LoginError { 9 #[error("error-smokesignal-login-1 DID document does not contain a handle identifier")] 10 NoHandle, 11 12 /// Error when a DID document does not contain a PDS endpoint. 13 /// 14 /// This error occurs during authentication when the user's DID document 15 /// is retrieved but does not contain a required AT Protocol Personal 16 /// Data Server (PDS) endpoint. 17 #[error("error-smokesignal-login-2 DID document does not contain an AT Protocol PDS endpoint")] 18 NoPDS, 19 20 /// Error when an OAuth callback is incomplete. 21 /// 22 /// This error occurs when the OAuth authentication flow callback 23 /// returns with incomplete information, preventing successful authentication. 24 #[error("error-smokesignal-login-3 OAuth callback incomplete")] 25 OAuthCallbackIncomplete, 26 27 /// Error when there is an OAuth issuer mismatch. 28 /// 29 /// This error occurs when the issuer in the OAuth response does not 30 /// match the expected issuer, which could indicate a security issue. 31 #[error("error-smokesignal-login-4 OAuth issuer mismatch")] 32 OAuthIssuerMismatch, 33 34 /// Error when the login input appears to be an incomplete AT-handle. 35 /// 36 /// This error occurs when a user enters what appears to be a partial 37 /// AT-handle (alphanumeric without a domain). The user should append 38 /// ".bsky.social" and resubmit the form. 39 #[error("error-smokesignal-login-5 Please add '.bsky.social' to your handle and try again")] 40 IncompleteHandle, 41 42 /// Error when an OAuth request is not found in storage. 43 /// 44 /// This error occurs during the OAuth callback when the system cannot 45 /// find the corresponding OAuth request that was initiated, possibly 46 /// due to expiration or invalid state parameter. 47 #[error("error-smokesignal-login-6 oauth request not found in storage")] 48 OAuthRequestNotFound, 49}