use thiserror::Error; /// Represents errors that can occur during user login and authentication. /// /// These errors typically happen during the authentication process when users /// are logging in to the application, including OAuth flows and DID validation. #[derive(Debug, Error)] pub(crate) enum LoginError { #[error("error-smokesignal-login-1 DID document does not contain a handle identifier")] NoHandle, /// Error when a DID document does not contain a PDS endpoint. /// /// This error occurs during authentication when the user's DID document /// is retrieved but does not contain a required AT Protocol Personal /// Data Server (PDS) endpoint. #[error("error-smokesignal-login-2 DID document does not contain an AT Protocol PDS endpoint")] NoPDS, /// Error when an OAuth callback is incomplete. /// /// This error occurs when the OAuth authentication flow callback /// returns with incomplete information, preventing successful authentication. #[error("error-smokesignal-login-3 OAuth callback incomplete")] OAuthCallbackIncomplete, /// Error when there is an OAuth issuer mismatch. /// /// This error occurs when the issuer in the OAuth response does not /// match the expected issuer, which could indicate a security issue. #[error("error-smokesignal-login-4 OAuth issuer mismatch")] OAuthIssuerMismatch, /// Error when the login input appears to be an incomplete AT-handle. /// /// This error occurs when a user enters what appears to be a partial /// AT-handle (alphanumeric without a domain). The user should append /// ".bsky.social" and resubmit the form. #[error("error-smokesignal-login-5 Please add '.bsky.social' to your handle and try again")] IncompleteHandle, /// Error when an OAuth request is not found in storage. /// /// This error occurs during the OAuth callback when the system cannot /// find the corresponding OAuth request that was initiated, possibly /// due to expiration or invalid state parameter. #[error("error-smokesignal-login-6 oauth request not found in storage")] OAuthRequestNotFound, }