You can configure your action flow to issue an error at specified stages of the flow by using an error handler element.

An error handler element requires two inputs:

  • Specified error message of the failed action.

  • Action flow inputs.

If an action in your flow fails and the action flow contains an error handler element, an error message is issued alerting you of the action failure. The error handler is an action on its own. The following script is an example of an error handler that can be used in an action flow.

def handler(context, inputs): 
       
			errorMsg = inputs["errorMsg"]    
			flowInputs = inputs["flowInputs"]        

			print("Flow execution failed with error {0}".format(errorMsg))    
			print("Flow inputs were: {0}".format(flowInputs))        

		outputs = {       
				 "errorMsg": errorMsg,       
				 "flowInputs": flowInputs   
 }        

		return outputs

You can view the successful and failed runs on the Action Runs window.

In this example, the flow-with-handler action flow, which contains an error handler element, was run successfully. However, one of the actions in the flow failed, which then initiated the error handler to issue an error.