X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=bpmn%2FMSOCommonBPMN%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fonap%2Fso%2Fbpmn%2Fcommon%2Fscripts%2FExceptionUtil.groovy;h=c23150384e882313cc3efd6d5a317482086fec4f;hb=5184b28f6ec1170ae035ddd749d8bdf5b2064904;hp=a77320b7719496190d706940a11282fc994e1ad4;hpb=22673d5b7929ddb7936a0ccdfda111b17e6dc1b8;p=so.git diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index a77320b771..c23150384e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -22,6 +22,9 @@ package org.onap.so.bpmn.common.scripts +import org.onap.so.logger.LoggingAnchor +import org.onap.so.logger.ErrorCode + import static org.apache.commons.lang3.StringUtils.* import com.google.common.xml.XmlEscapers @@ -31,7 +34,7 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger +import org.onap.so.utils.TargetEntities import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -90,8 +93,8 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { buildWorkflowException(execution, 5000, modifiedErrorMessage) wfex = execution.getVariable("WorkflowException") - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), wfex.errorMessage); + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + ErrorCode.UnknownError.getValue(), wfex.errorMessage); return wfex } else { try { @@ -103,8 +106,8 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { logger.debug("mappedErrorMessage " + mappedErrorMessage) wfex = execution.getVariable("WorkflowException") - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", - MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), wfex.errorMessage); + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + ErrorCode.UnknownError.getValue(), wfex.errorMessage); return wfex } catch(Exception ex) { logger.debug("error mapping error, return null: " + ex) @@ -281,6 +284,16 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { execution.setVariable("WorkflowException", exception); logger.debug("Outgoing WorkflowException is " + exception) } + + public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, TargetEntities extSystemErrorSource) { + MsoUtils utils = new MsoUtils() + String processKey = getProcessKey(execution); + logger.debug("Building a WorkflowException for " + processKey) + + WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage, extSystemErrorSource); + execution.setVariable("WorkflowException", exception); + logger.debug("Outgoing WorkflowException is " + exception) + } /** * This error handling method builds a WorkflowException Object and throws a