Name

sn_nb_action.RAExceptionManager

Description

Maps all RA specific errors to its corresponding message and status code

Script

var RAExceptionManager = Class.create();
RAExceptionManager.prototype = {
  initialize: function(exceptionType, placeholders) {
      this.placeholders = placeholders;
      this.exceptionsMapper = {
          "INVALID_SCRIPT_INCLUDE": [40001, gs.getMessage("Invalid script include.")],
          "UNKNOWN_ERROR_OCCURED": [40002, gs.getMessage("Unknown error occured.")],
          "INVALID_FLOW": [40001, gs.getMessage("Invalid flow.")],
          "INVALID_OR_INACIVE_FLOW": [40001, gs.getMessage("Invalid or inactive flow.")],
          "INVALID_FLOW_OUTPUT": [40001, gs.getMessage("Invalid flow output.")],
          "INVALID_DECISION_TABLE": [40001, gs.getMessage("Invalid Decision table.")],
          "INVALID_OR_INACTIVE_DECISION_TABLE": [40001, gs.getMessage("Invalid or inactive Decision table.")],
          "INVALID_TREND_DEFINITION_CONFIG": [40001, gs.getMessage("Invalid Trend definition configuration.")]
      };
      if (this.exceptionsMapper[exceptionType]) {
          this.exceptionType = exceptionType;
      } else {
          this.exceptionType = "UNKNOWN_ERROR_OCCURED";
      }
  },

  getCode: function() {
      return this.exceptionsMapper[this.exceptionType][0];
  },

  getMessage: function() {
      return gs.getEscapedMessage(this.exceptionsMapper[this.exceptionType][1], this.placeholders);
  },

  getJSON: function() {
      var exceptionDetails = {};
      exceptionDetails[sn_nb_action.Constants.ERROR_CODE] = this.getCode();
      exceptionDetails[sn_nb_action.Constants.ERROR_MESSAGE] = this.getMessage();
      return exceptionDetails;
  },

  type: 'RAExceptionManager'
};

Sys ID

54d144d9a35f01100f6357fc26fcdafc

Offical Documentation

Official Docs: