ParseError.js 11 KB

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