-
-
Notifications
You must be signed in to change notification settings - Fork 595
/
Copy pathParseError.js
558 lines (493 loc) · 12 KB
/
ParseError.js
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
/**
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* Constructs a new Parse.Error object with the given code and message.
*
* @alias Parse.Error
*/
class ParseError extends Error {
/**
* @param {number} code An error code constant from <code>Parse.Error</code>.
* @param {string} message A detailed description of the error.
*/
constructor(code, message) {
super(message);
this.code = code;
Object.defineProperty(this, 'message', {
enumerable: true,
value: message,
});
}
toString() {
return 'ParseError: ' + this.code + ' ' + this.message;
}
}
/**
* Error code indicating some error other than those enumerated here.
*
* @property {number} OTHER_CAUSE
* @static
*/
ParseError.OTHER_CAUSE = -1;
/**
* Error code indicating that something has gone wrong with the server.
*
* @property {number} INTERNAL_SERVER_ERROR
* @static
*/
ParseError.INTERNAL_SERVER_ERROR = 1;
/**
* Error code indicating the connection to the Parse servers failed.
*
* @property {number} CONNECTION_FAILED
* @static
*/
ParseError.CONNECTION_FAILED = 100;
/**
* Error code indicating the specified object doesn't exist.
*
* @property {number} OBJECT_NOT_FOUND
* @static
*/
ParseError.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.
*
* @property {number} INVALID_QUERY
* @static
*/
ParseError.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.
*
* @property {number} INVALID_CLASS_NAME
* @static
*/
ParseError.INVALID_CLASS_NAME = 103;
/**
* Error code indicating an unspecified object id.
*
* @property {number} MISSING_OBJECT_ID
* @static
*/
ParseError.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.
*
* @property {number} INVALID_KEY_NAME
* @static
*/
ParseError.INVALID_KEY_NAME = 105;
/**
* Error code indicating a malformed pointer. You should not see this unless
* you have been mucking about changing internal Parse code.
*
* @property {number} INVALID_POINTER
* @static
*/
ParseError.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.
*
* @property {number} INVALID_JSON
* @static
*/
ParseError.INVALID_JSON = 107;
/**
* Error code indicating that the feature you tried to access is only
* available internally for testing purposes.
*
* @property {number} COMMAND_UNAVAILABLE
* @static
*/
ParseError.COMMAND_UNAVAILABLE = 108;
/**
* You must call Parse.initialize before using the Parse library.
*
* @property {number} NOT_INITIALIZED
* @static
*/
ParseError.NOT_INITIALIZED = 109;
/**
* Error code indicating that a field was set to an inconsistent type.
*
* @property {number} INCORRECT_TYPE
* @static
*/
ParseError.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 and starts with a letter.
*
* @property {number} INVALID_CHANNEL_NAME
* @static
*/
ParseError.INVALID_CHANNEL_NAME = 112;
/**
* Error code indicating that push is misconfigured.
*
* @property {number} PUSH_MISCONFIGURED
* @static
*/
ParseError.PUSH_MISCONFIGURED = 115;
/**
* Error code indicating that the object is too large.
*
* @property {number} OBJECT_TOO_LARGE
* @static
*/
ParseError.OBJECT_TOO_LARGE = 116;
/**
* Error code indicating that the operation isn't allowed for clients.
*
* @property {number} OPERATION_FORBIDDEN
* @static
*/
ParseError.OPERATION_FORBIDDEN = 119;
/**
* Error code indicating the result was not found in the cache.
*
* @property {number} CACHE_MISS
* @static
*/
ParseError.CACHE_MISS = 120;
/**
* Error code indicating that an invalid key was used in a nested
* JSONObject.
*
* @property {number} INVALID_NESTED_KEY
* @static
*/
ParseError.INVALID_NESTED_KEY = 121;
/**
* Error code indicating that an invalid filename was used for ParseFile.
* A valid file name contains only a-zA-Z0-9_. characters and is between 1
* and 128 characters.
*
* @property {number} INVALID_FILE_NAME
* @static
*/
ParseError.INVALID_FILE_NAME = 122;
/**
* Error code indicating an invalid ACL was provided.
*
* @property {number} INVALID_ACL
* @static
*/
ParseError.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.
*
* @property {number} TIMEOUT
* @static
*/
ParseError.TIMEOUT = 124;
/**
* Error code indicating that the email address was invalid.
*
* @property {number} INVALID_EMAIL_ADDRESS
* @static
*/
ParseError.INVALID_EMAIL_ADDRESS = 125;
/**
* Error code indicating a missing content type.
*
* @property {number} MISSING_CONTENT_TYPE
* @static
*/
ParseError.MISSING_CONTENT_TYPE = 126;
/**
* Error code indicating a missing content length.
*
* @property {number} MISSING_CONTENT_LENGTH
* @static
*/
ParseError.MISSING_CONTENT_LENGTH = 127;
/**
* Error code indicating an invalid content length.
*
* @property {number} INVALID_CONTENT_LENGTH
* @static
*/
ParseError.INVALID_CONTENT_LENGTH = 128;
/**
* Error code indicating a file that was too large.
*
* @property {number} FILE_TOO_LARGE
* @static
*/
ParseError.FILE_TOO_LARGE = 129;
/**
* Error code indicating an error saving a file.
*
* @property {number} FILE_SAVE_ERROR
* @static
*/
ParseError.FILE_SAVE_ERROR = 130;
/**
* Error code indicating that a unique field was given a value that is
* already taken.
*
* @property {number} DUPLICATE_VALUE
* @static
*/
ParseError.DUPLICATE_VALUE = 137;
/**
* Error code indicating that a role's name is invalid.
*
* @property {number} INVALID_ROLE_NAME
* @static
*/
ParseError.INVALID_ROLE_NAME = 139;
/**
* Error code indicating that an application quota was exceeded. Upgrade to
* resolve.
*
* @property {number} EXCEEDED_QUOTA
* @static
*/
ParseError.EXCEEDED_QUOTA = 140;
/**
* Error code indicating that a Cloud Code script failed.
*
* @property {number} SCRIPT_FAILED
* @static
*/
ParseError.SCRIPT_FAILED = 141;
/**
* Error code indicating that a Cloud Code validation failed.
*
* @property {number} VALIDATION_ERROR
* @static
*/
ParseError.VALIDATION_ERROR = 142;
/**
* Error code indicating that invalid image data was provided.
*
* @property {number} INVALID_IMAGE_DATA
* @static
*/
ParseError.INVALID_IMAGE_DATA = 143;
/**
* Error code indicating an unsaved file.
*
* @property {number} UNSAVED_FILE_ERROR
* @static
*/
ParseError.UNSAVED_FILE_ERROR = 151;
/**
* Error code indicating an invalid push time.
*
* @property {number} INVALID_PUSH_TIME_ERROR
* @static
*/
ParseError.INVALID_PUSH_TIME_ERROR = 152;
/**
* Error code indicating an error deleting a file.
*
* @property {number} FILE_DELETE_ERROR
* @static
*/
ParseError.FILE_DELETE_ERROR = 153;
/**
* Error code indicating an error deleting an unnamed file.
*
* @property {number} FILE_DELETE_UNNAMED_ERROR
* @static
*/
ParseError.FILE_DELETE_UNNAMED_ERROR = 161;
/**
* Error code indicating that the application has exceeded its request
* limit.
*
* @property {number} REQUEST_LIMIT_EXCEEDED
* @static
*/
ParseError.REQUEST_LIMIT_EXCEEDED = 155;
/**
* Error code indicating that the request was a duplicate and has been discarded due to
* idempotency rules.
*
* @property {number} DUPLICATE_REQUEST
* @static
*/
ParseError.DUPLICATE_REQUEST = 159;
/**
* Error code indicating an invalid event name.
*
* @property {number} INVALID_EVENT_NAME
* @static
*/
ParseError.INVALID_EVENT_NAME = 160;
/**
* Error code indicating that a field had an invalid value.
*
* @property {number} INVALID_VALUE
* @static
*/
ParseError.INVALID_VALUE = 162;
/**
* Error code indicating that the username is missing or empty.
*
* @property {number} USERNAME_MISSING
* @static
*/
ParseError.USERNAME_MISSING = 200;
/**
* Error code indicating that the password is missing or empty.
*
* @property {number} PASSWORD_MISSING
* @static
*/
ParseError.PASSWORD_MISSING = 201;
/**
* Error code indicating that the username has already been taken.
*
* @property {number} USERNAME_TAKEN
* @static
*/
ParseError.USERNAME_TAKEN = 202;
/**
* Error code indicating that the email has already been taken.
*
* @property {number} EMAIL_TAKEN
* @static
*/
ParseError.EMAIL_TAKEN = 203;
/**
* Error code indicating that the email is missing, but must be specified.
*
* @property {number} EMAIL_MISSING
* @static
*/
ParseError.EMAIL_MISSING = 204;
/**
* Error code indicating that a user with the specified email was not found.
*
* @property {number} EMAIL_NOT_FOUND
* @static
*/
ParseError.EMAIL_NOT_FOUND = 205;
/**
* Error code indicating that the email has already been verified and can not be verified again.
*
* @property {number} EMAIL_ALREADY_VERIFIED
* @static
*/
ParseError.EMAIL_ALREADY_VERIFIED = 212;
/**
* Error code indicating that a user object without a valid session could
* not be altered.
*
* @property {number} SESSION_MISSING
* @static
*/
ParseError.SESSION_MISSING = 206;
/**
* Error code indicating that a user can only be created through signup.
*
* @property {number} MUST_CREATE_USER_THROUGH_SIGNUP
* @static
*/
ParseError.MUST_CREATE_USER_THROUGH_SIGNUP = 207;
/**
* Error code indicating that an an account being linked is already linked
* to another user.
*
* @property {number} ACCOUNT_ALREADY_LINKED
* @static
*/
ParseError.ACCOUNT_ALREADY_LINKED = 208;
/**
* Error code indicating that the current session token is invalid.
*
* @property {number} INVALID_SESSION_TOKEN
* @static
*/
ParseError.INVALID_SESSION_TOKEN = 209;
/**
* Error code indicating an error enabling or verifying MFA
*
* @property {number} MFA_ERROR
* @static
*/
ParseError.MFA_ERROR = 210;
/**
* Error code indicating that a valid MFA token must be provided
*
* @property {number} MFA_TOKEN_REQUIRED
* @static
*/
ParseError.MFA_TOKEN_REQUIRED = 211;
/**
* Error code indicating that a user cannot be linked to an account because
* that account's id could not be found.
*
* @property {number} LINKED_ID_MISSING
* @static
*/
ParseError.LINKED_ID_MISSING = 250;
/**
* Error code indicating that a user with a linked (e.g. Facebook) account
* has an invalid session.
*
* @property {number} INVALID_LINKED_SESSION
* @static
*/
ParseError.INVALID_LINKED_SESSION = 251;
/**
* Error code indicating that a service being linked (e.g. Facebook or
* Twitter) is unsupported.
*
* @property {number} UNSUPPORTED_SERVICE
* @static
*/
ParseError.UNSUPPORTED_SERVICE = 252;
/**
* Error code indicating an invalid operation occured on schema
*
* @property {number} INVALID_SCHEMA_OPERATION
* @static
*/
ParseError.INVALID_SCHEMA_OPERATION = 255;
/**
* Error code indicating that there were multiple errors. Aggregate errors
* have an "errors" property, which is an array of error objects with more
* detail about each error that occurred.
*
* @property {number} AGGREGATE_ERROR
* @static
*/
ParseError.AGGREGATE_ERROR = 600;
/**
* Error code indicating the client was unable to read an input file.
*
* @property {number} FILE_READ_ERROR
* @static
*/
ParseError.FILE_READ_ERROR = 601;
/**
* 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.
*
* @property {number} X_DOMAIN_REQUEST
* @static
*/
ParseError.X_DOMAIN_REQUEST = 602;
export default ParseError;