Try Catch - Send email in case of error in workflow with multiple branches

Dear all,
I have a workflow with 2 branches and I would like to send an email and write the error in a DB in case of error anywhere in the workflow.
Consider that the workflow has 2 branches: when one is activated the other is not (and vice-versa). I would like to send an alert only when a branches is deactivated because of an error (and not because the branch is deactivated normally because of the rule that I have created).
I have attached a simple fake workflow with some comments inside.

How can I solve this issue? Please could you help me?

Ideally, it would be even better if I could send just one email if the error happens everywhere.

Thanks
Regards

Try Catch Error Handling 2.knwf (76.7 KB)

Hi @iiiaaa,

I can’t find any catch nodes in your workflow. What you could try is to just encapsulate the whole workflow with a try catch block and if there is any error value in the second output port (reason for failure) of the catch error node, you can trigger an e-mail to be send.

Does that work for you?

Best,
Marten

Dear Marten,
thanks for your answer. The problem is that I do not know where and how to insert the Catch in my workflow because I have 2 branches. May I kindly ask you to insert it in my workflow ?

Thanks
Regards

Hi @iiiaaa,

I’ve attached a possible solution for you. I’ve arranged it in a way such that the Catch Error node will catch any error occurring in the workflow. But there is a drawback to this solution: If many errors occur, only the latest error message will be populated by the Catch Error node. It is probably better to put one Catch Error node per branch in your workflow. This way you can overcome this drawback and have individual error handling instead of just saving the error messages.

Best,
Marten

Try Catch Error Handling.knwf (48.2 KB)

1 Like

Thank you very much!

1 Like