Skip to content

Commit

Permalink
Improve exception messages when calling runtimeService.trigger(execut…
Browse files Browse the repository at this point in the history
…ionId)
  • Loading branch information
jbarrez committed Jun 12, 2017
1 parent e94bd5f commit 42f588d
Showing 1 changed file with 13 additions and 3 deletions.
Expand Up @@ -46,19 +46,29 @@ public void run() {
if (currentFlowElement instanceof BoundaryEvent) {
commandContext.getHistoryManager().recordActivityStart(execution);
}

((TriggerableActivityBehavior) activityBehavior).trigger(execution, null, null);

if (currentFlowElement instanceof BoundaryEvent) {
commandContext.getHistoryManager().recordActivityEnd(execution, null);
}

} else {
throw new FlowableException("Invalid behavior: " + activityBehavior + " should implement " + TriggerableActivityBehavior.class.getName());
throw new FlowableException("Cannot trigger execution with id " + execution.getId()
+ " : the activityBehavior " + activityBehavior.getClass() + " does not implement the "
+ TriggerableActivityBehavior.class.getName() + " interface");

}

} else if (currentFlowElement == null) {
throw new FlowableException("Cannot trigger execution with id " + execution.getId()
+ " : no current flow element found. Check the execution id that is being passed "
+ "(it should not be a process instance execution, but a child execution currently referencing a flow element).");

} else {
throw new FlowableException("Programmatic error: no current flow element found or invalid type: " + currentFlowElement + ". Halting.");
throw new FlowableException("Programmatic error: cannot trigger execution, invalid flowelement type found: "
+ currentFlowElement.getClass().getName() + ".");

}
}

Expand Down

0 comments on commit 42f588d

Please sign in to comment.