forked from leancloud/javascript-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.js
More file actions
341 lines (289 loc) · 7.39 KB
/
Copy patherror.js
File metadata and controls
341 lines (289 loc) · 7.39 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
/**
* 每位工程师都有保持代码优雅的义务
* Each engineer has a duty to keep the code elegant
**/
const _ = require('underscore');
// Class used for all objects passed to error callbacks
function AVError(code, message) {
const error = new Error(message);
error.code = code;
return error;
}
_.extend(AVError, {
/**
* Error code indicating some error other than those enumerated here.
* @constant
*/
OTHER_CAUSE: -1,
/**
* Error code indicating that something has gone wrong with the server.
* If you get this error code, it is AV's fault. Contact us at
* https://avoscloud.com/help
* @constant
*/
INTERNAL_SERVER_ERROR: 1,
/**
* Error code indicating the connection to the AV servers failed.
* @constant
*/
CONNECTION_FAILED: 100,
/**
* Error code indicating the specified object doesn't exist.
* @constant
*/
OBJECT_NOT_FOUND: 101,
/**
* Error code indicating you tried to query with a datatype that doesn't
* support it, like exact matching an array or object.
* @constant
*/
INVALID_QUERY: 102,
/**
* Error code indicating a missing or invalid classname. Classnames are
* case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
* only valid characters.
* @constant
*/
INVALID_CLASS_NAME: 103,
/**
* Error code indicating an unspecified object id.
* @constant
*/
MISSING_OBJECT_ID: 104,
/**
* Error code indicating an invalid key name. Keys are case-sensitive. They
* must start with a letter, and a-zA-Z0-9_ are the only valid characters.
* @constant
*/
INVALID_KEY_NAME: 105,
/**
* Error code indicating a malformed pointer. You should not see this unless
* you have been mucking about changing internal AV code.
* @constant
*/
INVALID_POINTER: 106,
/**
* Error code indicating that badly formed JSON was received upstream. This
* either indicates you have done something unusual with modifying how
* things encode to JSON, or the network is failing badly.
* @constant
*/
INVALID_JSON: 107,
/**
* Error code indicating that the feature you tried to access is only
* available internally for testing purposes.
* @constant
*/
COMMAND_UNAVAILABLE: 108,
/**
* You must call AV.initialize before using the AV library.
* @constant
*/
NOT_INITIALIZED: 109,
/**
* Error code indicating that a field was set to an inconsistent type.
* @constant
*/
INCORRECT_TYPE: 111,
/**
* Error code indicating an invalid channel name. A channel name is either
* an empty string (the broadcast channel) or contains only a-zA-Z0-9_
* characters.
* @constant
*/
INVALID_CHANNEL_NAME: 112,
/**
* Error code indicating that push is misconfigured.
* @constant
*/
PUSH_MISCONFIGURED: 115,
/**
* Error code indicating that the object is too large.
* @constant
*/
OBJECT_TOO_LARGE: 116,
/**
* Error code indicating that the operation isn't allowed for clients.
* @constant
*/
OPERATION_FORBIDDEN: 119,
/**
* Error code indicating the result was not found in the cache.
* @constant
*/
CACHE_MISS: 120,
/**
* Error code indicating that an invalid key was used in a nested
* JSONObject.
* @constant
*/
INVALID_NESTED_KEY: 121,
/**
* Error code indicating that an invalid filename was used for AVFile.
* A valid file name contains only a-zA-Z0-9_. characters and is between 1
* and 128 characters.
* @constant
*/
INVALID_FILE_NAME: 122,
/**
* Error code indicating an invalid ACL was provided.
* @constant
*/
INVALID_ACL: 123,
/**
* Error code indicating that the request timed out on the server. Typically
* this indicates that the request is too expensive to run.
* @constant
*/
TIMEOUT: 124,
/**
* Error code indicating that the email address was invalid.
* @constant
*/
INVALID_EMAIL_ADDRESS: 125,
/**
* Error code indicating a missing content type.
* @constant
*/
MISSING_CONTENT_TYPE: 126,
/**
* Error code indicating a missing content length.
* @constant
*/
MISSING_CONTENT_LENGTH: 127,
/**
* Error code indicating an invalid content length.
* @constant
*/
INVALID_CONTENT_LENGTH: 128,
/**
* Error code indicating a file that was too large.
* @constant
*/
FILE_TOO_LARGE: 129,
/**
* Error code indicating an error saving a file.
* @constant
*/
FILE_SAVE_ERROR: 130,
/**
* Error code indicating an error deleting a file.
* @constant
*/
FILE_DELETE_ERROR: 153,
/**
* Error code indicating that a unique field was given a value that is
* already taken.
* @constant
*/
DUPLICATE_VALUE: 137,
/**
* Error code indicating that a role's name is invalid.
* @constant
*/
INVALID_ROLE_NAME: 139,
/**
* Error code indicating that an application quota was exceeded. Upgrade to
* resolve.
* @constant
*/
EXCEEDED_QUOTA: 140,
/**
* Error code indicating that a Cloud Code script failed.
* @constant
*/
SCRIPT_FAILED: 141,
/**
* Error code indicating that a Cloud Code validation failed.
* @constant
*/
VALIDATION_ERROR: 142,
/**
* Error code indicating that invalid image data was provided.
* @constant
*/
INVALID_IMAGE_DATA: 150,
/**
* Error code indicating an unsaved file.
* @constant
*/
UNSAVED_FILE_ERROR: 151,
/**
* Error code indicating an invalid push time.
*/
INVALID_PUSH_TIME_ERROR: 152,
/**
* Error code indicating that the username is missing or empty.
* @constant
*/
USERNAME_MISSING: 200,
/**
* Error code indicating that the password is missing or empty.
* @constant
*/
PASSWORD_MISSING: 201,
/**
* Error code indicating that the username has already been taken.
* @constant
*/
USERNAME_TAKEN: 202,
/**
* Error code indicating that the email has already been taken.
* @constant
*/
EMAIL_TAKEN: 203,
/**
* Error code indicating that the email is missing, but must be specified.
* @constant
*/
EMAIL_MISSING: 204,
/**
* Error code indicating that a user with the specified email was not found.
* @constant
*/
EMAIL_NOT_FOUND: 205,
/**
* Error code indicating that a user object without a valid session could
* not be altered.
* @constant
*/
SESSION_MISSING: 206,
/**
* Error code indicating that a user can only be created through signup.
* @constant
*/
MUST_CREATE_USER_THROUGH_SIGNUP: 207,
/**
* Error code indicating that an an account being linked is already linked
* to another user.
* @constant
*/
ACCOUNT_ALREADY_LINKED: 208,
/**
* Error code indicating that a user cannot be linked to an account because
* that account's id could not be found.
* @constant
*/
LINKED_ID_MISSING: 250,
/**
* Error code indicating that a user with a linked (e.g. Facebook) account
* has an invalid session.
* @constant
*/
INVALID_LINKED_SESSION: 251,
/**
* Error code indicating that a service being linked (e.g. Facebook or
* Twitter) is unsupported.
* @constant
*/
UNSUPPORTED_SERVICE: 252,
/**
* Error code indicating a real error code is unavailable because
* we had to use an XDomainRequest object to allow CORS requests in
* Internet Explorer, which strips the body from HTTP responses that have
* a non-2XX status code.
* @constant
*/
X_DOMAIN_REQUEST: 602,
});
module.exports = AVError;