@@ -14,167 +14,165 @@ pub type ServiceResult<V> = Result<V, ServiceError>;
1414#[ derive( Debug , Display , PartialEq , Eq , Error ) ]
1515#[ allow( dead_code) ]
1616pub enum ServiceError {
17- #[ display( fmt = "internal server error" ) ]
17+ #[ display( "internal server error" ) ]
1818 InternalServerError ,
1919
20- #[ display( fmt = "This server is is closed for registration. Contact admin if this is unexpected" ) ]
20+ #[ display( "This server is is closed for registration. Contact admin if this is unexpected" ) ]
2121 ClosedForRegistration ,
2222
23- #[ display( fmt = "Email is required" ) ] //405j
23+ #[ display( "Email is required" ) ] //405j
2424 EmailMissing ,
25- #[ display( fmt = "Please enter a valid email address" ) ] //405j
25+ #[ display( "Please enter a valid email address" ) ] //405j
2626 EmailInvalid ,
2727
28- #[ display( fmt = "The value you entered for URL is not a URL" ) ] //405j
28+ #[ display( "The value you entered for URL is not a URL" ) ] //405j
2929 NotAUrl ,
3030
31- #[ display( fmt = "Invalid username/email or password" ) ]
31+ #[ display( "Invalid username/email or password" ) ]
3232 WrongPasswordOrUsername ,
33- #[ display( fmt = "Invalid password" ) ]
33+ #[ display( "Invalid password" ) ]
3434 InvalidPassword ,
35- #[ display( fmt = "Username not found" ) ]
35+ #[ display( "Username not found" ) ]
3636 UsernameNotFound ,
37- #[ display( fmt = "User not found" ) ]
37+ #[ display( "User not found" ) ]
3838 UserNotFound ,
3939
40- #[ display( fmt = "Account not found" ) ]
40+ #[ display( "Account not found" ) ]
4141 AccountNotFound ,
4242
4343 /// when the value passed contains profanity
44- #[ display( fmt = "Can't allow profanity in usernames" ) ]
44+ #[ display( "Can't allow profanity in usernames" ) ]
4545 ProfanityError ,
4646 /// when the value passed contains blacklisted words
4747 /// see [blacklist](https://github.com/shuttlecraft/The-Big-Username-Blacklist)
48- #[ display( fmt = "Username contains blacklisted words" ) ]
48+ #[ display( "Username contains blacklisted words" ) ]
4949 BlacklistError ,
5050 /// when the value passed contains characters not present
5151 /// in [UsernameCaseMapped](https://tools.ietf.org/html/rfc8265#page-7)
5252 /// profile
53- #[ display( fmt = "username_case_mapped violation" ) ]
53+ #[ display( "username_case_mapped violation" ) ]
5454 UsernameCaseMappedError ,
5555
56- #[ display( fmt = "Password too short" ) ]
56+ #[ display( "Password too short" ) ]
5757 PasswordTooShort ,
58- #[ display( fmt = "Password too long" ) ]
58+ #[ display( "Password too long" ) ]
5959 PasswordTooLong ,
60- #[ display( fmt = "Passwords don't match" ) ]
60+ #[ display( "Passwords don't match" ) ]
6161 PasswordsDontMatch ,
6262
6363 /// when the a username is already taken
64- #[ display( fmt = "Username not available" ) ]
64+ #[ display( "Username not available" ) ]
6565 UsernameTaken ,
6666
67- #[ display( fmt = "Invalid username. Usernames must consist of 1-20 alphanumeric characters, dashes, or underscore" ) ]
67+ #[ display( "Invalid username. Usernames must consist of 1-20 alphanumeric characters, dashes, or underscore" ) ]
6868 UsernameInvalid ,
6969
7070 /// email is already taken
71- #[ display( fmt = "Email not available" ) ]
71+ #[ display( "Email not available" ) ]
7272 EmailTaken ,
7373
74- #[ display( fmt = "Please verify your email before logging in" ) ]
74+ #[ display( "Please verify your email before logging in" ) ]
7575 EmailNotVerified ,
7676
7777 /// when the a token name is already taken
7878 /// token not found
79- #[ display( fmt = "Token not found. Please sign in." ) ]
79+ #[ display( "Token not found. Please sign in." ) ]
8080 TokenNotFound ,
8181
8282 /// token expired
83- #[ display( fmt = "Token expired. Please sign in again." ) ]
83+ #[ display( "Token expired. Please sign in again." ) ]
8484 TokenExpired ,
8585
86- #[ display( fmt = "Token invalid." ) ]
86+ #[ display( "Token invalid." ) ]
8787 /// token invalid
8888 TokenInvalid ,
8989
90- #[ display( fmt = "Uploaded torrent is not valid." ) ]
90+ #[ display( "Uploaded torrent is not valid." ) ]
9191 InvalidTorrentFile ,
9292
93- #[ display( fmt = "Uploaded torrent has an invalid pieces key." ) ]
93+ #[ display( "Uploaded torrent has an invalid pieces key." ) ]
9494 InvalidTorrentPiecesLength ,
9595
96- #[ display( fmt = "Only .torrent files can be uploaded." ) ]
96+ #[ display( "Only .torrent files can be uploaded." ) ]
9797 InvalidFileType ,
9898
99- #[ display( fmt = "Torrent title is too short." ) ]
99+ #[ display( "Torrent title is too short." ) ]
100100 InvalidTorrentTitleLength ,
101101
102- #[ display( fmt = "Some mandatory metadata fields are missing." ) ]
102+ #[ display( "Some mandatory metadata fields are missing." ) ]
103103 MissingMandatoryMetadataFields ,
104104
105- #[ display( fmt = "Selected category does not exist." ) ]
105+ #[ display( "Selected category does not exist." ) ]
106106 InvalidCategory ,
107107
108- #[ display( fmt = "Selected tag does not exist." ) ]
108+ #[ display( "Selected tag does not exist." ) ]
109109 InvalidTag ,
110110
111- #[ display( fmt = "Unauthorized action." ) ]
111+ #[ display( "Unauthorized action." ) ]
112112 UnauthorizedAction ,
113113
114- #[ display(
115- fmt = "Unauthorized actions for guest users. Try logging in to check if you have permission to perform the action"
116- ) ]
114+ #[ display( "Unauthorized actions for guest users. Try logging in to check if you have permission to perform the action" ) ]
117115 UnauthorizedActionForGuests ,
118116
119- #[ display( fmt = "This torrent already exists in our database." ) ]
117+ #[ display( "This torrent already exists in our database." ) ]
120118 InfoHashAlreadyExists ,
121119
122- #[ display( fmt = "A torrent with the same canonical infohash already exists in our database." ) ]
120+ #[ display( "A torrent with the same canonical infohash already exists in our database." ) ]
123121 CanonicalInfoHashAlreadyExists ,
124122
125- #[ display( fmt = "A torrent with the same original infohash already exists in our database." ) ]
123+ #[ display( "A torrent with the same original infohash already exists in our database." ) ]
126124 OriginalInfoHashAlreadyExists ,
127125
128- #[ display( fmt = "This torrent title has already been used." ) ]
126+ #[ display( "This torrent title has already been used." ) ]
129127 TorrentTitleAlreadyExists ,
130128
131- #[ display( fmt = "Could not whitelist torrent." ) ]
129+ #[ display( "Could not whitelist torrent." ) ]
132130 WhitelistingError ,
133131
134- #[ display( fmt = "Failed to send verification email." ) ]
132+ #[ display( "Failed to send verification email." ) ]
135133 FailedToSendVerificationEmail ,
136134
137- #[ display( fmt = "Category already exists." ) ]
135+ #[ display( "Category already exists." ) ]
138136 CategoryAlreadyExists ,
139137
140- #[ display( fmt = "Category name cannot be empty." ) ]
138+ #[ display( "Category name cannot be empty." ) ]
141139 CategoryNameEmpty ,
142140
143- #[ display( fmt = "Tag already exists." ) ]
141+ #[ display( "Tag already exists." ) ]
144142 TagAlreadyExists ,
145143
146- #[ display( fmt = "Tag name cannot be empty." ) ]
144+ #[ display( "Tag name cannot be empty." ) ]
147145 TagNameEmpty ,
148146
149- #[ display( fmt = "Torrent not found." ) ]
147+ #[ display( "Torrent not found." ) ]
150148 TorrentNotFound ,
151149
152- #[ display( fmt = "Category not found." ) ]
150+ #[ display( "Category not found." ) ]
153151 CategoryNotFound ,
154152
155- #[ display( fmt = "Tag not found." ) ]
153+ #[ display( "Tag not found." ) ]
156154 TagNotFound ,
157155
158- #[ display( fmt = "Database error." ) ]
156+ #[ display( "Database error." ) ]
159157 DatabaseError ,
160158
161- #[ display( fmt = "Authentication error, please sign in" ) ]
159+ #[ display( "Authentication error, please sign in" ) ]
162160 LoggedInUserNotFound ,
163161
164162 // Begin tracker errors
165- #[ display( fmt = "Sorry, we have an error with our tracker connection." ) ]
163+ #[ display( "Sorry, we have an error with our tracker connection." ) ]
166164 TrackerOffline ,
167165
168- #[ display( fmt = "Tracker response error. The operation could not be performed." ) ]
166+ #[ display( "Tracker response error. The operation could not be performed." ) ]
169167 TrackerResponseError ,
170168
171- #[ display( fmt = "Tracker unknown response. Unexpected response from tracker. For example, if it can't be parsed." ) ]
169+ #[ display( "Tracker unknown response. Unexpected response from tracker. For example, if it can't be parsed." ) ]
172170 TrackerUnknownResponse ,
173171
174- #[ display( fmt = "Torrent not found in tracker." ) ]
172+ #[ display( "Torrent not found in tracker." ) ]
175173 TorrentNotFoundInTracker ,
176174
177- #[ display( fmt = "Invalid tracker API token." ) ]
175+ #[ display( "Invalid tracker API token." ) ]
178176 InvalidTrackerToken ,
179177 // End tracker errors
180178}
0 commit comments