Workflow activity error handling

  • 15 August 2022
  • 1 reply
  • 92 views

Userlevel 2
Badge +3
  • When writing some programs especially for business purpose, we need to implemente "proper" error handling to avoid unexpected errors, this is applicable when we write Commvault workflows.
  • But sometimes it's slightly tricky to capture exception happened in some activities, without care the workflow itself simply stops with error, if the workflow is set as Job mode the job is sit pending.
  • To avoid this situation you need to set 2 parameters in the activity you want to capture the event, which is described in the following Documentation but not so intuitive: General Properties for Workflow Activities

For testing, we create a Script activity which simply raise exceptions (divide by zero) as follows:

When reaching this activity, workflow would stop with the following error, quite straightforward:

To capture the error we need to modify 2 properties on this activity:

  • "Continue after max restarts" from "false" to "true"
  • "Maximum restarts" from empty to "0"

 

 

With this setting, the next activity would be executed after the exception, so based on the condition and error message / status of this activity itself we can implement error handling logic after that.

Hope this helps,


1 reply

Userlevel 7
Badge +23

Thanks for sharing!

We get a lot of interest here for Workflows.

Reply