SmartsRecommenderError.js 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. 'use strict';
  2. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6. /*
  7. *+------------------------------------------------------------------------+
  8. *| Licensed Materials - Property of IBM
  9. *| IBM Cognos Products: Dashboard
  10. *| (C) Copyright IBM Corp. 2018
  11. *|
  12. *| US Government Users Restricted Rights - Use, duplication or disclosure
  13. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  14. *+------------------------------------------------------------------------+
  15. */
  16. define(['../../widgets/livewidget/nls/StringResources'], function (StringResources) {
  17. 'use strict';
  18. var SmartsRecommenderError = function (_Error) {
  19. _inherits(SmartsRecommenderError, _Error);
  20. _createClass(SmartsRecommenderError, null, [{
  21. key: 'STATUS',
  22. // Smarts Recommender status codes
  23. get: function get() {
  24. return {
  25. OK: 0,
  26. NO_SMARTS_MODULE_SPECIFIED: 1,
  27. SMARTS_MODULE_NOT_FOUND: 2,
  28. SMARTS_MODULE_TIMEOUT: 3,
  29. JSON_ERROR_IN_INPUT: 4,
  30. UNKNOWN_CHART_TYPE: 5,
  31. MISSING_REQUIRED_PARAMETERS: 6,
  32. UNKNOWN_CHART_SPECIFIED: 7,
  33. NO_UNBOUND_COLUMNS: 8,
  34. INVALID_LEARNING_DIRECTIVE: 9,
  35. INVALID_ACTION_TYPE: 10,
  36. INVALID_ACTION_PAYLOAD: 11,
  37. COLUMNS_NOT_FROM_SAME_OR_JOINED_DATASET: 12,
  38. MISSING_ACTION: 13,
  39. SMARTS_MODULE_NOT_READY: 14,
  40. NO_COLUMNS: 15,
  41. INVALID_BINDING: 16,
  42. ERROR: 100
  43. };
  44. }
  45. /**
  46. * Static property to load SmartsRecommenderError common message
  47. */
  48. }, {
  49. key: 'msg',
  50. get: function get() {
  51. // ensure the common message is loaded only once
  52. if (!SmartsRecommenderError._message) {
  53. SmartsRecommenderError._message = StringResources.get('recommendRequestFailed');
  54. }
  55. return SmartsRecommenderError._message;
  56. }
  57. }]);
  58. function SmartsRecommenderError(status, details) {
  59. _classCallCheck(this, SmartsRecommenderError);
  60. var _this = _possibleConstructorReturn(this, _Error.call(this, SmartsRecommenderError.msg));
  61. _this.status = status;
  62. _this.details = details;
  63. return _this;
  64. }
  65. return SmartsRecommenderError;
  66. }(Error);
  67. // common message appied to all SmartsRecommenderError instances
  68. SmartsRecommenderError._message = null;
  69. return SmartsRecommenderError;
  70. });
  71. //# sourceMappingURL=SmartsRecommenderError.js.map