How to throw an exception an catch it correctly

Hi experts,

I’m using Bonita Community 7.3.3 and I have a Service Task which calls a database procedure. Depending of the result it throws an exception or not:

if (result!=null) {
throw new Exception("Error in postprocess: " + result)
}

I’ve added a boundary catch error in order to derive to an email warning but it’s not working. A screenshot here:

https://josegante.tinytake.com/sf/MTM1OTIwMl80OTY5MzY4

What am I doing wrong?

Thanks a lot,
Jose.

The way we do this is:

In our connector code (your Post-Process):

set dataToBeReturned == failed; While(next){ dataToBeReturned == records; } return dataToBeReturned;

We do not use a boundary event but use a gateway where if dataToBeReturned == failed then go to your Unexpected Error Mail else go to your Send Email To Requester.

Much easier than using Handlers in this case.

regards
Seán

PS: As this reply answers your question, please mark as resolved by ticking the tick mark on the left of this reply.

I’ve been able to solve it with an error subprocess:

https://josegante.tinytake.com/sf/MTM2MjQ4M180OTc2MDkw

Regards,
Jose.

Thanks for your help Sean.
Is there any way to catch any unexpected error without having to specify all the paths from all the possible source task that can fail to the generic “email to sysadmin” task ?