-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrorCodes.js
More file actions
241 lines (239 loc) · 6.12 KB
/
errorCodes.js
File metadata and controls
241 lines (239 loc) · 6.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
export const noUserId = { name: 'noUserId', message: 'No User ID Given', status: 400 }
export const noUserFoundId = {
name: 'noUserFoundId',
message: 'No User Found With Given ID',
status: 400
}
export const noUserFoundUsername = {
name: 'noUserFoundUsername',
message: 'No User Found With Given Username',
status: 400
}
export const noUsername = { name: 'noUsername', message: 'No Username Given', status: 400 }
export const missingCredentials = {
name: 'missingCredentials',
message: 'Missing required credentials, please try again.',
status: 400
}
export const notSameUser = {
name: 'notSameUser',
message: 'You are not authorized to perform this action.',
status: 401
}
export const wrongCredentials = {
name: 'wrongCredentials',
message: 'Username and/or Password Incorrect',
status: 401
}
export const failedLoginRegister = {
name: 'failedLoginRegister',
message: 'Unsuccessful login or register, please try again!',
status: 400
}
export const tokenMalformed = (prefix) => ({
name: 'TokenMalformed',
message: `Authorization token must start with '${prefix}'`,
status: 400
})
export const authHeaderError = {
name: 'AuthorizationHeaderError',
message: 'Authorization token malformed',
status: 401
}
export const noUser = { name: 'noUser', message: 'No User Given', status: 400 }
export const notAdmin = { name: 'notAdmin', message: 'User Not Admin', status: 401 }
export const notAuthorized = {
name: 'notAuthorized',
message: "You don't have authorization for this action"
}
export const unknownError = {
name: 'unknownError',
message: 'Something went wrong, please try again'
}
export const cannotFindUser = {
name: 'cannotFindUser',
message: 'Cannot validate User Token or Id',
status: 400
}
export const usernameAlreadyExists = {
name: 'usernameAlreadyExists',
status: 400,
message: 'Username Already Exists'
}
export const unknownType = {
name: 'unknownType',
message: 'Unknown Type Given for Check',
status: 400
}
export const badCreateColor = {
name: 'badCreateColor',
message: 'Could not create Color. Try again',
status: 400
}
export const badGetColors = {
name: 'badGetColors',
message: 'Could not get Colors. Try again',
status: 400
}
export const badGetColor = {
name: 'badGetColor',
message: 'Could not get Color. Try again',
status: 400
}
export const badUpdateColor = {
name: 'badUpdateColor',
message: 'Could not update Color. Try again',
status: 400
}
export const badDeleteColor = {
name: 'badDeleteColor',
message: 'Could not delete Color. Try again',
status: 400
}
export const badCreateModel = {
name: 'badCreateModel',
message: 'Could not create Model. Try again',
status: 400
}
export const badGetModel = {
name: 'badGetModel',
message: 'Could not get Model. Try again',
status: 400
}
export const badGetModels = {
name: 'badGetModels',
message: 'Could not get Model. Try again',
status: 400
}
export const badUpdateModel = {
name: 'badUpdateModel',
message: 'Could not update Model. Try again',
status: 400
}
export const badDeleteModel = {
name: 'badDeleteModel',
message: 'Could not delete Model. Try again',
status: 400
}
export const badCreatePattern = {
name: 'badCreatePattern',
message: 'Could not create Pattern. Try again',
status: 400
}
export const badGetPattern = {
name: 'badGetPattern',
message: 'Could not get Pattern. Try again',
status: 400
}
export const badGetPatterns = {
name: 'badGetPatterns',
message: 'Could not get Patterns. Try again',
status: 400
}
export const badUpdatePattern = {
name: 'badUpdatePattern',
message: 'Could not update Pattern. Try again',
status: 400
}
export const badDeletePattern = {
name: 'badDeletePattern',
message: 'Could not delete Pattern. Try again',
status: 400
}
export const badCreateClient = {
name: 'badCreateClient',
message: 'Something went wrong creating Client. Please try again.',
status: 400
}
export const badGetClients = {
name: 'badGetClients',
message: 'Something went wrong getting Clients. Please try again.',
status: 400
}
export const badGetClient = {
name: 'badGetClient',
message: 'Something went wrong getting Client. Please try again.',
status: 400
}
export const badUpdateClient = {
name: 'badUpdateClient',
message: 'Something went wrong updating Client. Please try again.',
status: 400
}
export const badDeactivateClient = {
name: 'badDeactivateClient',
message: 'Something went wrong deactivating Client. Please try again.',
status: 400
}
export const badReactivateClient = {
name: 'badReactivateClient',
message: 'Something went wrong reactivating Client. Please try again.',
status: 400
}
export const badCreateFavorite = {
name: 'badCreateFavorite',
message: 'Something went wrong creating Client Favorite. Please try again.',
status: 400
}
export const badGetFavorite = {
name: 'badGetFavorite',
message: 'Something went wrong getting Client Favorite. Please try again.',
status: 400
}
export const badGetFavorites = {
name: 'badGetFavorites',
message: 'Something went wrong getting Client Favorites. Please try again.',
status: 400
}
export const badUpdateFavorite = {
name: 'badUpdateFavorite',
message: 'Something went wrong updating Client Favorite. Please try again.',
status: 400
}
export const badDeleteFavorite = {
name: 'badDeleteFavorite',
message: 'Something went wrong deleting Client Favorite. Please try again.',
status: 400
}
export const badCreatePiece = {
name: 'badCreatePiece',
message: 'Something went wrong creating Piece. Please try again.',
status: 400
}
export default {
noUserId,
noUserFoundId,
noUserFoundUsername,
noUsername,
notSameUser,
missingCredentials,
wrongCredentials,
tokenMalformed,
authHeaderError,
noUser,
notAdmin,
notAuthorized,
unknownError,
cannotFindUser,
badCreateColor,
badGetColors,
badGetColor,
badUpdateColor,
badDeleteColor,
badCreateModel,
badGetModel,
badGetModels,
badUpdateModel,
badDeleteModel,
badCreatePattern,
badGetPattern,
badGetPatterns,
badUpdatePattern,
badDeletePattern,
badCreateClient,
badGetClients,
badGetClient,
badUpdateClient,
badDeactivateClient,
badReactivateClient
}