You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the ServiceError enum we only support a single error message with no extra data.
#[derive(Debug,Display,PartialEq,Eq,Error)]#[allow(dead_code)]pubenumServiceError{#[display(fmt = "internal server error")]InternalServerError,#[display(fmt = "This server is is closed for registration. Contact admin if this is unexpected")]ClosedForRegistration,#[display(fmt = "Email is required")]//405jEmailMissing,#[display(fmt = "Please enter a valid email address")]//405jEmailInvalid,#[display(fmt = "The value you entered for URL is not a URL")]//405jNotAUrl,#[display(fmt = "Invalid username/email or password")]WrongPasswordOrUsername,#[display(fmt = "Username not found")]UsernameNotFound,#[display(fmt = "User not found")]UserNotFound,#[display(fmt = "Account not found")]AccountNotFound,/// when the value passed contains profanity#[display(fmt = "Can't allow profanity in usernames")]ProfanityError,/// when the value passed contains blacklisted words/// see [blacklist](https://github.com/shuttlecraft/The-Big-Username-Blacklist)#[display(fmt = "Username contains blacklisted words")]BlacklistError,/// when the value passed contains characters not present/// in [UsernameCaseMapped](https://tools.ietf.org/html/rfc8265#page-7)/// profile#[display(fmt = "username_case_mapped violation")]UsernameCaseMappedError,#[display(fmt = "Password too short")]PasswordTooShort,#[display(fmt = "Username too long")]PasswordTooLong,#[display(fmt = "Passwords don't match")]PasswordsDontMatch,/// when the a username is already taken#[display(fmt = "Username not available")]UsernameTaken,#[display(fmt = "Invalid username. Usernames must consist of 1-20 alphanumeric characters, dashes, or underscore")]UsernameInvalid,/// email is already taken#[display(fmt = "Email not available")]EmailTaken,#[display(fmt = "Please verify your email before logging in")]EmailNotVerified,/// when the a token name is already taken/// token not found#[display(fmt = "Token not found. Please sign in.")]TokenNotFound,/// token expired#[display(fmt = "Token expired. Please sign in again.")]TokenExpired,#[display(fmt = "Token invalid.")]/// token invalidTokenInvalid,#[display(fmt = "Uploaded torrent is not valid.")]InvalidTorrentFile,// ...#[display(fmt = "This torrent already exists in our database.")]InfoHashAlreadyExists,#[display(fmt = "A torrent with the same canonical infohash already exists in our database.")]CanonicalInfoHashAlreadyExists,// ...#[display(fmt = "Tracker unknown response. Unexpected response from tracker. For example, if it can be parsed.")]TrackerUnknownResponse,#[display(fmt = "Torrent not found in tracker.")]TorrentNotFoundInTracker,#[display(fmt = "Invalid tracker API token.")]InvalidTrackerToken,// End tracker errors}
For some of them, it would be better if we add extra data. FOr example, the error:
#[display(fmt = "A torrent with the same canonical infohash already exists in our database.")]
CanonicalInfoHashAlreadyExists,
should give you the info-hash, so the user can search/navigate to see the pre-existing torrent.
We can do it like we do for other error enums with the thiserror crate.
use thiserror::Error;#[derive(Debug,Error)]pubenumServiceError{#[error("internal server error: {0}")]InternalServerError(String),// other variants...}
The text was updated successfully, but these errors were encountered:
In the
ServiceError
enum we only support a single error message with no extra data.For some of them, it would be better if we add extra data. FOr example, the error:
should give you the info-hash, so the user can search/navigate to see the pre-existing torrent.
We can do it like we do for other error enums with the
thiserror
crate.The text was updated successfully, but these errors were encountered: