ParseError.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. /**
  7. * Constructs a new Parse.Error object with the given code and message.
  8. *
  9. * @alias Parse.Error
  10. */
  11. class ParseError extends Error {
  12. /**
  13. * @param {number} code An error code constant from <code>Parse.Error</code>.
  14. * @param {string} message A detailed description of the error.
  15. */
  16. constructor(code, message) {
  17. super(message);
  18. this.code = code;
  19. Object.defineProperty(this, 'message', {
  20. enumerable: true,
  21. value: message
  22. });
  23. }
  24. toString() {
  25. return 'ParseError: ' + this.code + ' ' + this.message;
  26. }
  27. }
  28. /**
  29. * Error code indicating some error other than those enumerated here.
  30. *
  31. * @property {number} OTHER_CAUSE
  32. * @static
  33. */
  34. ParseError.OTHER_CAUSE = -1;
  35. /**
  36. * Error code indicating that something has gone wrong with the server.
  37. *
  38. * @property {number} INTERNAL_SERVER_ERROR
  39. * @static
  40. */
  41. ParseError.INTERNAL_SERVER_ERROR = 1;
  42. /**
  43. * Error code indicating the connection to the Parse servers failed.
  44. *
  45. * @property {number} CONNECTION_FAILED
  46. * @static
  47. */
  48. ParseError.CONNECTION_FAILED = 100;
  49. /**
  50. * Error code indicating the specified object doesn't exist.
  51. *
  52. * @property {number} OBJECT_NOT_FOUND
  53. * @static
  54. */
  55. ParseError.OBJECT_NOT_FOUND = 101;
  56. /**
  57. * Error code indicating you tried to query with a datatype that doesn't
  58. * support it, like exact matching an array or object.
  59. *
  60. * @property {number} INVALID_QUERY
  61. * @static
  62. */
  63. ParseError.INVALID_QUERY = 102;
  64. /**
  65. * Error code indicating a missing or invalid classname. Classnames are
  66. * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
  67. * only valid characters.
  68. *
  69. * @property {number} INVALID_CLASS_NAME
  70. * @static
  71. */
  72. ParseError.INVALID_CLASS_NAME = 103;
  73. /**
  74. * Error code indicating an unspecified object id.
  75. *
  76. * @property {number} MISSING_OBJECT_ID
  77. * @static
  78. */
  79. ParseError.MISSING_OBJECT_ID = 104;
  80. /**
  81. * Error code indicating an invalid key name. Keys are case-sensitive. They
  82. * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
  83. *
  84. * @property {number} INVALID_KEY_NAME
  85. * @static
  86. */
  87. ParseError.INVALID_KEY_NAME = 105;
  88. /**
  89. * Error code indicating a malformed pointer. You should not see this unless
  90. * you have been mucking about changing internal Parse code.
  91. *
  92. * @property {number} INVALID_POINTER
  93. * @static
  94. */
  95. ParseError.INVALID_POINTER = 106;
  96. /**
  97. * Error code indicating that badly formed JSON was received upstream. This
  98. * either indicates you have done something unusual with modifying how
  99. * things encode to JSON, or the network is failing badly.
  100. *
  101. * @property {number} INVALID_JSON
  102. * @static
  103. */
  104. ParseError.INVALID_JSON = 107;
  105. /**
  106. * Error code indicating that the feature you tried to access is only
  107. * available internally for testing purposes.
  108. *
  109. * @property {number} COMMAND_UNAVAILABLE
  110. * @static
  111. */
  112. ParseError.COMMAND_UNAVAILABLE = 108;
  113. /**
  114. * You must call Parse.initialize before using the Parse library.
  115. *
  116. * @property {number} NOT_INITIALIZED
  117. * @static
  118. */
  119. ParseError.NOT_INITIALIZED = 109;
  120. /**
  121. * Error code indicating that a field was set to an inconsistent type.
  122. *
  123. * @property {number} INCORRECT_TYPE
  124. * @static
  125. */
  126. ParseError.INCORRECT_TYPE = 111;
  127. /**
  128. * Error code indicating an invalid channel name. A channel name is either
  129. * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
  130. * characters and starts with a letter.
  131. *
  132. * @property {number} INVALID_CHANNEL_NAME
  133. * @static
  134. */
  135. ParseError.INVALID_CHANNEL_NAME = 112;
  136. /**
  137. * Error code indicating that push is misconfigured.
  138. *
  139. * @property {number} PUSH_MISCONFIGURED
  140. * @static
  141. */
  142. ParseError.PUSH_MISCONFIGURED = 115;
  143. /**
  144. * Error code indicating that the object is too large.
  145. *
  146. * @property {number} OBJECT_TOO_LARGE
  147. * @static
  148. */
  149. ParseError.OBJECT_TOO_LARGE = 116;
  150. /**
  151. * Error code indicating that the operation isn't allowed for clients.
  152. *
  153. * @property {number} OPERATION_FORBIDDEN
  154. * @static
  155. */
  156. ParseError.OPERATION_FORBIDDEN = 119;
  157. /**
  158. * Error code indicating the result was not found in the cache.
  159. *
  160. * @property {number} CACHE_MISS
  161. * @static
  162. */
  163. ParseError.CACHE_MISS = 120;
  164. /**
  165. * Error code indicating that an invalid key was used in a nested
  166. * JSONObject.
  167. *
  168. * @property {number} INVALID_NESTED_KEY
  169. * @static
  170. */
  171. ParseError.INVALID_NESTED_KEY = 121;
  172. /**
  173. * Error code indicating that an invalid filename was used for ParseFile.
  174. * A valid file name contains only a-zA-Z0-9_. characters and is between 1
  175. * and 128 characters.
  176. *
  177. * @property {number} INVALID_FILE_NAME
  178. * @static
  179. */
  180. ParseError.INVALID_FILE_NAME = 122;
  181. /**
  182. * Error code indicating an invalid ACL was provided.
  183. *
  184. * @property {number} INVALID_ACL
  185. * @static
  186. */
  187. ParseError.INVALID_ACL = 123;
  188. /**
  189. * Error code indicating that the request timed out on the server. Typically
  190. * this indicates that the request is too expensive to run.
  191. *
  192. * @property {number} TIMEOUT
  193. * @static
  194. */
  195. ParseError.TIMEOUT = 124;
  196. /**
  197. * Error code indicating that the email address was invalid.
  198. *
  199. * @property {number} INVALID_EMAIL_ADDRESS
  200. * @static
  201. */
  202. ParseError.INVALID_EMAIL_ADDRESS = 125;
  203. /**
  204. * Error code indicating a missing content type.
  205. *
  206. * @property {number} MISSING_CONTENT_TYPE
  207. * @static
  208. */
  209. ParseError.MISSING_CONTENT_TYPE = 126;
  210. /**
  211. * Error code indicating a missing content length.
  212. *
  213. * @property {number} MISSING_CONTENT_LENGTH
  214. * @static
  215. */
  216. ParseError.MISSING_CONTENT_LENGTH = 127;
  217. /**
  218. * Error code indicating an invalid content length.
  219. *
  220. * @property {number} INVALID_CONTENT_LENGTH
  221. * @static
  222. */
  223. ParseError.INVALID_CONTENT_LENGTH = 128;
  224. /**
  225. * Error code indicating a file that was too large.
  226. *
  227. * @property {number} FILE_TOO_LARGE
  228. * @static
  229. */
  230. ParseError.FILE_TOO_LARGE = 129;
  231. /**
  232. * Error code indicating an error saving a file.
  233. *
  234. * @property {number} FILE_SAVE_ERROR
  235. * @static
  236. */
  237. ParseError.FILE_SAVE_ERROR = 130;
  238. /**
  239. * Error code indicating that a unique field was given a value that is
  240. * already taken.
  241. *
  242. * @property {number} DUPLICATE_VALUE
  243. * @static
  244. */
  245. ParseError.DUPLICATE_VALUE = 137;
  246. /**
  247. * Error code indicating that a role's name is invalid.
  248. *
  249. * @property {number} INVALID_ROLE_NAME
  250. * @static
  251. */
  252. ParseError.INVALID_ROLE_NAME = 139;
  253. /**
  254. * Error code indicating that an application quota was exceeded. Upgrade to
  255. * resolve.
  256. *
  257. * @property {number} EXCEEDED_QUOTA
  258. * @static
  259. */
  260. ParseError.EXCEEDED_QUOTA = 140;
  261. /**
  262. * Error code indicating that a Cloud Code script failed.
  263. *
  264. * @property {number} SCRIPT_FAILED
  265. * @static
  266. */
  267. ParseError.SCRIPT_FAILED = 141;
  268. /**
  269. * Error code indicating that a Cloud Code validation failed.
  270. *
  271. * @property {number} VALIDATION_ERROR
  272. * @static
  273. */
  274. ParseError.VALIDATION_ERROR = 142;
  275. /**
  276. * Error code indicating that invalid image data was provided.
  277. *
  278. * @property {number} INVALID_IMAGE_DATA
  279. * @static
  280. */
  281. ParseError.INVALID_IMAGE_DATA = 143;
  282. /**
  283. * Error code indicating an unsaved file.
  284. *
  285. * @property {number} UNSAVED_FILE_ERROR
  286. * @static
  287. */
  288. ParseError.UNSAVED_FILE_ERROR = 151;
  289. /**
  290. * Error code indicating an invalid push time.
  291. *
  292. * @property {number} INVALID_PUSH_TIME_ERROR
  293. * @static
  294. */
  295. ParseError.INVALID_PUSH_TIME_ERROR = 152;
  296. /**
  297. * Error code indicating an error deleting a file.
  298. *
  299. * @property {number} FILE_DELETE_ERROR
  300. * @static
  301. */
  302. ParseError.FILE_DELETE_ERROR = 153;
  303. /**
  304. * Error code indicating an error deleting an unnamed file.
  305. *
  306. * @property {number} FILE_DELETE_UNNAMED_ERROR
  307. * @static
  308. */
  309. ParseError.FILE_DELETE_UNNAMED_ERROR = 161;
  310. /**
  311. * Error code indicating that the application has exceeded its request
  312. * limit.
  313. *
  314. * @property {number} REQUEST_LIMIT_EXCEEDED
  315. * @static
  316. */
  317. ParseError.REQUEST_LIMIT_EXCEEDED = 155;
  318. /**
  319. * Error code indicating that the request was a duplicate and has been discarded due to
  320. * idempotency rules.
  321. *
  322. * @property {number} DUPLICATE_REQUEST
  323. * @static
  324. */
  325. ParseError.DUPLICATE_REQUEST = 159;
  326. /**
  327. * Error code indicating an invalid event name.
  328. *
  329. * @property {number} INVALID_EVENT_NAME
  330. * @static
  331. */
  332. ParseError.INVALID_EVENT_NAME = 160;
  333. /**
  334. * Error code indicating that a field had an invalid value.
  335. *
  336. * @property {number} INVALID_VALUE
  337. * @static
  338. */
  339. ParseError.INVALID_VALUE = 162;
  340. /**
  341. * Error code indicating that the username is missing or empty.
  342. *
  343. * @property {number} USERNAME_MISSING
  344. * @static
  345. */
  346. ParseError.USERNAME_MISSING = 200;
  347. /**
  348. * Error code indicating that the password is missing or empty.
  349. *
  350. * @property {number} PASSWORD_MISSING
  351. * @static
  352. */
  353. ParseError.PASSWORD_MISSING = 201;
  354. /**
  355. * Error code indicating that the username has already been taken.
  356. *
  357. * @property {number} USERNAME_TAKEN
  358. * @static
  359. */
  360. ParseError.USERNAME_TAKEN = 202;
  361. /**
  362. * Error code indicating that the email has already been taken.
  363. *
  364. * @property {number} EMAIL_TAKEN
  365. * @static
  366. */
  367. ParseError.EMAIL_TAKEN = 203;
  368. /**
  369. * Error code indicating that the email is missing, but must be specified.
  370. *
  371. * @property {number} EMAIL_MISSING
  372. * @static
  373. */
  374. ParseError.EMAIL_MISSING = 204;
  375. /**
  376. * Error code indicating that a user with the specified email was not found.
  377. *
  378. * @property {number} EMAIL_NOT_FOUND
  379. * @static
  380. */
  381. ParseError.EMAIL_NOT_FOUND = 205;
  382. /**
  383. * Error code indicating that a user object without a valid session could
  384. * not be altered.
  385. *
  386. * @property {number} SESSION_MISSING
  387. * @static
  388. */
  389. ParseError.SESSION_MISSING = 206;
  390. /**
  391. * Error code indicating that a user can only be created through signup.
  392. *
  393. * @property {number} MUST_CREATE_USER_THROUGH_SIGNUP
  394. * @static
  395. */
  396. ParseError.MUST_CREATE_USER_THROUGH_SIGNUP = 207;
  397. /**
  398. * Error code indicating that an an account being linked is already linked
  399. * to another user.
  400. *
  401. * @property {number} ACCOUNT_ALREADY_LINKED
  402. * @static
  403. */
  404. ParseError.ACCOUNT_ALREADY_LINKED = 208;
  405. /**
  406. * Error code indicating that the current session token is invalid.
  407. *
  408. * @property {number} INVALID_SESSION_TOKEN
  409. * @static
  410. */
  411. ParseError.INVALID_SESSION_TOKEN = 209;
  412. /**
  413. * Error code indicating an error enabling or verifying MFA
  414. *
  415. * @property {number} MFA_ERROR
  416. * @static
  417. */
  418. ParseError.MFA_ERROR = 210;
  419. /**
  420. * Error code indicating that a valid MFA token must be provided
  421. *
  422. * @property {number} MFA_TOKEN_REQUIRED
  423. * @static
  424. */
  425. ParseError.MFA_TOKEN_REQUIRED = 211;
  426. /**
  427. * Error code indicating that a user cannot be linked to an account because
  428. * that account's id could not be found.
  429. *
  430. * @property {number} LINKED_ID_MISSING
  431. * @static
  432. */
  433. ParseError.LINKED_ID_MISSING = 250;
  434. /**
  435. * Error code indicating that a user with a linked (e.g. Facebook) account
  436. * has an invalid session.
  437. *
  438. * @property {number} INVALID_LINKED_SESSION
  439. * @static
  440. */
  441. ParseError.INVALID_LINKED_SESSION = 251;
  442. /**
  443. * Error code indicating that a service being linked (e.g. Facebook or
  444. * Twitter) is unsupported.
  445. *
  446. * @property {number} UNSUPPORTED_SERVICE
  447. * @static
  448. */
  449. ParseError.UNSUPPORTED_SERVICE = 252;
  450. /**
  451. * Error code indicating an invalid operation occured on schema
  452. *
  453. * @property {number} INVALID_SCHEMA_OPERATION
  454. * @static
  455. */
  456. ParseError.INVALID_SCHEMA_OPERATION = 255;
  457. /**
  458. * Error code indicating that there were multiple errors. Aggregate errors
  459. * have an "errors" property, which is an array of error objects with more
  460. * detail about each error that occurred.
  461. *
  462. * @property {number} AGGREGATE_ERROR
  463. * @static
  464. */
  465. ParseError.AGGREGATE_ERROR = 600;
  466. /**
  467. * Error code indicating the client was unable to read an input file.
  468. *
  469. * @property {number} FILE_READ_ERROR
  470. * @static
  471. */
  472. ParseError.FILE_READ_ERROR = 601;
  473. /**
  474. * Error code indicating a real error code is unavailable because
  475. * we had to use an XDomainRequest object to allow CORS requests in
  476. * Internet Explorer, which strips the body from HTTP responses that have
  477. * a non-2XX status code.
  478. *
  479. * @property {number} X_DOMAIN_REQUEST
  480. * @static
  481. */
  482. ParseError.X_DOMAIN_REQUEST = 602;
  483. var _default = ParseError;
  484. exports.default = _default;