Get error details in subprocess

1
0
-1

Hello

I have a process with several script tasks. Specifically I have a task that insert data into a database and one that call a webservice

I configured the connectors on those tasks to send an error if the connector fails and created a subprocess to catch those errors. I want to send a mail to a specific email with error details. I found how to get root process instanciator, access process variables... but not how to get the error name or best, the stack trace of the exception that made the connector fail. Even the name of the error that started the subprocess would be a plus

Any hint on how to achieve that?

1 answer

1
0
-1

In the general settings of your first script you could choose
"if a connector fails": Throw error event, and
"named error": Error1

In your step (e.g. the service task that contains this script), you can drag and drop a Catch error Int.event. In the General tab of this error event you choose as "Associated error" : Error1.

Then add another service task that contains just an email connector, that sends the email. in the body you can hardcode the cause of the error (it will be from you first script), and maybe values if some related process values.
Then you connect the Catch error with this new service task.

You can add a Catch error event for every error that is thown from a script.

Regading the exception i donot know how you could save it.
Hope this helped.

Comments

Submitted by g.lapierre on Tue, 05/29/2018 - 12:17

Thanks. I know I could use boundary start events to catch those errors but I wanted something more generic. This is why I am trying to create a subprocess. In this subprocess I could use 2 (or more) error start event and bind the start to a given error message. But for more complex processes with more and more scripts that makes more and more duplicates of the globally same code.

Maybe a solution is to create a subprocess variable, use several start event that set the variable and join all the starts to a single "send mail" action. I will check if this is OK. Edit: that does not work, a sub-process cannot have several start event

Submitted by mtsiak_1358773 on Tue, 05/29/2018 - 12:38

I think that these tools safer from being generic. Of course we should try our best..

You could add try/catch in your scripts, and in the catch to return something like
return "ERROR"+ex.getMessage() and save the output to a variable.

In the end of your subprocess, you can add a XOR gateway, where you could check if the returned variable starts with 'ERROR' and then add a task process with an email message.

Apologies for not helping you enough.

Notifications