Name
sn_rf.RFExceptionManager
Description
Maps all RF specific errors to its corresponding message and status code
Script
var RFExceptionManager = Class.create();
RFExceptionManager.prototype = {
initialize: function(exceptionType, placeholders) {
this.exceptionType = exceptionType;
this.placeholders = placeholders;
this.exceptionsMapper = {
"INVALID_SIMILARITY_SOLUTION_DEFINITION": [40001, gs.getMessage("Invalid similarity solution definition.")],
"INVALID_CLASSIFICATION_SOLUTION_DEFINITION": [40001, gs.getMessage("Invalid classification solution definition.")],
"INVALID_TREND_DEFINITION": [40001, gs.getMessage("Invalid trend definition.")],
"INVALID_TREND_DEFINITION_CONFIG": [40001, gs.getMessage("Invalid trend definition configuration.")],
"INVALID_CONDITIONAL_DEFINITION": [40001, gs.getMessage("Invalid conditional definition.")],
"INVALID_CONDITIONAL_DEFINITION_CONFIG": [40001, gs.getMessage('Conditional definitions are added for tables other than {0}. Please remove such records from rule')],
"INVALID_PIWB_USECASE": [40001, gs.getMessage("Invalid PIWB usecase.")],
"INVALID_SCRIPT_INCLUDE": [40001, gs.getMessage("Invalid script include.")],
"INVALID_RECORD": [40001, gs.getMessage("Invalid record provided. Please check the recordTable and recordSysId")],
"MARK_COMPLETE_FAILED": [40001, gs.getMessage("There was an error while moving recommendation to history.")],
"MARK_REVERT_FAILED": [40001, gs.getMessage("There was an error while moving recommendation back to current.")],
"UNAUTHORIZED_ACTION": [40001, gs.getMessage("Action is not authorized.")],
"UNKNOWN_ERROR": [40000, gs.getMessage("Unknown error occurred.")]
};
},
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[RFConstants.ERROR_CODE] = this.getCode();
exceptionDetails[RFConstants.ERROR_MESSAGE] = this.getMessage();
return exceptionDetails;
},
type: 'RFExceptionManager'
};
Sys ID
40f9aea4534330103953ddeeff7b1286