From 757a0ca529716eed2882c1227df5270a1c24bbaf Mon Sep 17 00:00:00 2001 From: "Benjamin, Max" Date: Wed, 26 Jun 2019 11:35:00 -0400 Subject: improved logging when no exception data is found improved logging when no exception data is found Change-Id: I4f6298652ad474119cd1ebc58a927d532ea3e6be Issue-ID: SO-2068 Signed-off-by: Benjamin, Max (mb388a) --- .../bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bpmn/so-bpmn-tasks/src') diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java index 35ceef0473..4d2f9fd98c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java @@ -125,7 +125,7 @@ public class WorkflowActionBBFailure { } private Optional retrieveErrorMessage(DelegateExecution execution) { - String errorMsg = ""; + String errorMsg = null; try { WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException"); if (exception != null && (exception.getErrorMessage() != null || !exception.getErrorMessage().equals(""))) { @@ -134,6 +134,10 @@ public class WorkflowActionBBFailure { if (errorMsg == null || errorMsg.equals("")) { errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage"); } + if (errorMsg == null) { + throw new IllegalStateException( + "could not find WorkflowException or WorkflowExceptionErrorMessage in execution"); + } return Optional.of(errorMsg); } catch (Exception ex) { logger.error("Failed to extract workflow exception from execution.", ex); -- cgit 1.2.3-korg