@@ -14,167 +14,165 @@ pub type ServiceResult<V> = Result<V, ServiceError>;
14
14
#[ derive( Debug , Display , PartialEq , Eq , Error ) ]
15
15
#[ allow( dead_code) ]
16
16
pub enum ServiceError {
17
- #[ display( fmt = "internal server error" ) ]
17
+ #[ display( "internal server error" ) ]
18
18
InternalServerError ,
19
19
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" ) ]
21
21
ClosedForRegistration ,
22
22
23
- #[ display( fmt = "Email is required" ) ] //405j
23
+ #[ display( "Email is required" ) ] //405j
24
24
EmailMissing ,
25
- #[ display( fmt = "Please enter a valid email address" ) ] //405j
25
+ #[ display( "Please enter a valid email address" ) ] //405j
26
26
EmailInvalid ,
27
27
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
29
29
NotAUrl ,
30
30
31
- #[ display( fmt = "Invalid username/email or password" ) ]
31
+ #[ display( "Invalid username/email or password" ) ]
32
32
WrongPasswordOrUsername ,
33
- #[ display( fmt = "Invalid password" ) ]
33
+ #[ display( "Invalid password" ) ]
34
34
InvalidPassword ,
35
- #[ display( fmt = "Username not found" ) ]
35
+ #[ display( "Username not found" ) ]
36
36
UsernameNotFound ,
37
- #[ display( fmt = "User not found" ) ]
37
+ #[ display( "User not found" ) ]
38
38
UserNotFound ,
39
39
40
- #[ display( fmt = "Account not found" ) ]
40
+ #[ display( "Account not found" ) ]
41
41
AccountNotFound ,
42
42
43
43
/// when the value passed contains profanity
44
- #[ display( fmt = "Can't allow profanity in usernames" ) ]
44
+ #[ display( "Can't allow profanity in usernames" ) ]
45
45
ProfanityError ,
46
46
/// when the value passed contains blacklisted words
47
47
/// see [blacklist](https://github.com/shuttlecraft/The-Big-Username-Blacklist)
48
- #[ display( fmt = "Username contains blacklisted words" ) ]
48
+ #[ display( "Username contains blacklisted words" ) ]
49
49
BlacklistError ,
50
50
/// when the value passed contains characters not present
51
51
/// in [UsernameCaseMapped](https://tools.ietf.org/html/rfc8265#page-7)
52
52
/// profile
53
- #[ display( fmt = "username_case_mapped violation" ) ]
53
+ #[ display( "username_case_mapped violation" ) ]
54
54
UsernameCaseMappedError ,
55
55
56
- #[ display( fmt = "Password too short" ) ]
56
+ #[ display( "Password too short" ) ]
57
57
PasswordTooShort ,
58
- #[ display( fmt = "Password too long" ) ]
58
+ #[ display( "Password too long" ) ]
59
59
PasswordTooLong ,
60
- #[ display( fmt = "Passwords don't match" ) ]
60
+ #[ display( "Passwords don't match" ) ]
61
61
PasswordsDontMatch ,
62
62
63
63
/// when the a username is already taken
64
- #[ display( fmt = "Username not available" ) ]
64
+ #[ display( "Username not available" ) ]
65
65
UsernameTaken ,
66
66
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" ) ]
68
68
UsernameInvalid ,
69
69
70
70
/// email is already taken
71
- #[ display( fmt = "Email not available" ) ]
71
+ #[ display( "Email not available" ) ]
72
72
EmailTaken ,
73
73
74
- #[ display( fmt = "Please verify your email before logging in" ) ]
74
+ #[ display( "Please verify your email before logging in" ) ]
75
75
EmailNotVerified ,
76
76
77
77
/// when the a token name is already taken
78
78
/// token not found
79
- #[ display( fmt = "Token not found. Please sign in." ) ]
79
+ #[ display( "Token not found. Please sign in." ) ]
80
80
TokenNotFound ,
81
81
82
82
/// token expired
83
- #[ display( fmt = "Token expired. Please sign in again." ) ]
83
+ #[ display( "Token expired. Please sign in again." ) ]
84
84
TokenExpired ,
85
85
86
- #[ display( fmt = "Token invalid." ) ]
86
+ #[ display( "Token invalid." ) ]
87
87
/// token invalid
88
88
TokenInvalid ,
89
89
90
- #[ display( fmt = "Uploaded torrent is not valid." ) ]
90
+ #[ display( "Uploaded torrent is not valid." ) ]
91
91
InvalidTorrentFile ,
92
92
93
- #[ display( fmt = "Uploaded torrent has an invalid pieces key." ) ]
93
+ #[ display( "Uploaded torrent has an invalid pieces key." ) ]
94
94
InvalidTorrentPiecesLength ,
95
95
96
- #[ display( fmt = "Only .torrent files can be uploaded." ) ]
96
+ #[ display( "Only .torrent files can be uploaded." ) ]
97
97
InvalidFileType ,
98
98
99
- #[ display( fmt = "Torrent title is too short." ) ]
99
+ #[ display( "Torrent title is too short." ) ]
100
100
InvalidTorrentTitleLength ,
101
101
102
- #[ display( fmt = "Some mandatory metadata fields are missing." ) ]
102
+ #[ display( "Some mandatory metadata fields are missing." ) ]
103
103
MissingMandatoryMetadataFields ,
104
104
105
- #[ display( fmt = "Selected category does not exist." ) ]
105
+ #[ display( "Selected category does not exist." ) ]
106
106
InvalidCategory ,
107
107
108
- #[ display( fmt = "Selected tag does not exist." ) ]
108
+ #[ display( "Selected tag does not exist." ) ]
109
109
InvalidTag ,
110
110
111
- #[ display( fmt = "Unauthorized action." ) ]
111
+ #[ display( "Unauthorized action." ) ]
112
112
UnauthorizedAction ,
113
113
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" ) ]
117
115
UnauthorizedActionForGuests ,
118
116
119
- #[ display( fmt = "This torrent already exists in our database." ) ]
117
+ #[ display( "This torrent already exists in our database." ) ]
120
118
InfoHashAlreadyExists ,
121
119
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." ) ]
123
121
CanonicalInfoHashAlreadyExists ,
124
122
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." ) ]
126
124
OriginalInfoHashAlreadyExists ,
127
125
128
- #[ display( fmt = "This torrent title has already been used." ) ]
126
+ #[ display( "This torrent title has already been used." ) ]
129
127
TorrentTitleAlreadyExists ,
130
128
131
- #[ display( fmt = "Could not whitelist torrent." ) ]
129
+ #[ display( "Could not whitelist torrent." ) ]
132
130
WhitelistingError ,
133
131
134
- #[ display( fmt = "Failed to send verification email." ) ]
132
+ #[ display( "Failed to send verification email." ) ]
135
133
FailedToSendVerificationEmail ,
136
134
137
- #[ display( fmt = "Category already exists." ) ]
135
+ #[ display( "Category already exists." ) ]
138
136
CategoryAlreadyExists ,
139
137
140
- #[ display( fmt = "Category name cannot be empty." ) ]
138
+ #[ display( "Category name cannot be empty." ) ]
141
139
CategoryNameEmpty ,
142
140
143
- #[ display( fmt = "Tag already exists." ) ]
141
+ #[ display( "Tag already exists." ) ]
144
142
TagAlreadyExists ,
145
143
146
- #[ display( fmt = "Tag name cannot be empty." ) ]
144
+ #[ display( "Tag name cannot be empty." ) ]
147
145
TagNameEmpty ,
148
146
149
- #[ display( fmt = "Torrent not found." ) ]
147
+ #[ display( "Torrent not found." ) ]
150
148
TorrentNotFound ,
151
149
152
- #[ display( fmt = "Category not found." ) ]
150
+ #[ display( "Category not found." ) ]
153
151
CategoryNotFound ,
154
152
155
- #[ display( fmt = "Tag not found." ) ]
153
+ #[ display( "Tag not found." ) ]
156
154
TagNotFound ,
157
155
158
- #[ display( fmt = "Database error." ) ]
156
+ #[ display( "Database error." ) ]
159
157
DatabaseError ,
160
158
161
- #[ display( fmt = "Authentication error, please sign in" ) ]
159
+ #[ display( "Authentication error, please sign in" ) ]
162
160
LoggedInUserNotFound ,
163
161
164
162
// 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." ) ]
166
164
TrackerOffline ,
167
165
168
- #[ display( fmt = "Tracker response error. The operation could not be performed." ) ]
166
+ #[ display( "Tracker response error. The operation could not be performed." ) ]
169
167
TrackerResponseError ,
170
168
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." ) ]
172
170
TrackerUnknownResponse ,
173
171
174
- #[ display( fmt = "Torrent not found in tracker." ) ]
172
+ #[ display( "Torrent not found in tracker." ) ]
175
173
TorrentNotFoundInTracker ,
176
174
177
- #[ display( fmt = "Invalid tracker API token." ) ]
175
+ #[ display( "Invalid tracker API token." ) ]
178
176
InvalidTrackerToken ,
179
177
// End tracker errors
180
178
}
0 commit comments