ParseError.js 12 KB

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