Catching errorMessage sent from Java

I have a simple process. An exception which is BpmnError will be thrown from my Java code and I want to catch it like this which I do at the moment.

The problem is, I want to pass the error message sent from my Java code, to the Slack connector. How can I store that value and use it?