ParseError.js 14 KB

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