You need to add Message objects to the root WorkflowCase like so:
wfcontext.getRootWorkflowCase().addMessage(Message.error("Some error happened: " + e.getMessage(), null));
The TaskResult tied to the WorkflowCase will persist these messages.
You need to add Message objects to the root WorkflowCase like so:
wfcontext.getRootWorkflowCase().addMessage(Message.error("Some error happened: " + e.getMessage(), null));
The TaskResult tied to the WorkflowCase will persist these messages.