Try

This action allows you to:

  • Monitor errors while the actions are being executed.

  • Run an alternative set of actions if an error occurs.

Try action creates Do and On error placeholders for actions. All actions that should execute if a trigger fires, must be placed inside the Do placeholder. If no error is detected when executing actions from Do placeholder, these are the only actions that ever execute. However, if an error does happen, the execution of actions from Do placeholder stops and the execution switches over to actions from On error placeholder.

Note

You must enable Synchronous Printing to catch errors with On error.

UUID-3cce3b0f-703f-8112-8657-b94a17ee1a7c.png

Example

If any action in the Do placeholder fails, the action execution stops and resumes with the actions in the On Error placeholder. If Try would be placed on its own, that would terminate the trigger execution. In our case, Try is nested under the For loop action. Normally, any error in Do placeholder would also stop executing the For loop action, even if there are still further steps until the For loop is complete. In this case, the Save Data to File action does not execute as well. By default, each error breaks the entire trigger processing. However, you can also continue with the execution of the next iteration in the For loop action. To make this happen, enable the Ignore failure option in the Try action. If the data from the current step in For Loop causes an error in the Do placeholder, the actions from On Error execute. After that, the Save Data to File in level 2 execute and then the For loop action continues to execute in the next iteration.

Tip

This action provides for an easy error detection and execution of "feedback" or "reporting" actions. For example, if an error happens during trigger processing, you can send out a warning. For more information, see section Print Job Status Feedback in Loftware Automation user guide.

Important

The Try action gives expected results with asynchronous actions. If your Try loop includes the Print Label action that fails, the action execution still completes the Try loop, and does not switch to the On error actions as expected. The result for not switching to the On error actions is the Print Label action that runs in synchronous mode by default. To avoid this, make sure supervised printing is on. Go to trigger settings > Other > Feedback from the Print Engine and enable Supervised printing.

Read more about supervised printing in Synchronous Print Mode.

About group identifies the selected action.

  • Name: allows you to define a custom action name. This makes actions easily recognizable on the solution's list of actions. By default, the action name is taken from its type.
  • Description: custom information about the action. Enter a description to explain the purpose and role of action in a solution.
  • Action type: read-only information about the selected action type.

Action Execution and Error Handling

Each action can be set as a conditional action. Conditional actions only run when the defined conditions allow them to be run. To define these conditions, click Show execution and error handling options.

Execution options are:

  • Enabled: specifies if the action is enabled or disabled. Only enabled actions will execute. This functionality may be used while testing a form.
  • Condition: defines one-line programming expression that must provide a Boolean value (true or false). When the result of the expression is true, the action will execute. Condition offers a way to avoid executing actions every time.

Error handling options are:

  • Ignore failure: specifies whether an error should be ignored. If enabled, the execution of actions continues even if the current action fails.

    Note

    Nested actions that depend on the current action do not execute in case of a failure. The execution of actions continues with the next action on the same level as the current action. The error is logged but does not break the execution of the action.

  • Example

    At the end of printing, you might want to send the status update to an external application using the HTTP Request action. If the printing action fails, action processing stops. In order to execute the reporting even after the failed print action, the Print Label action must have the option Ignore failure enabled.

  • Save error to variable: allows you to select or create a variable to save the error to. The same cause of the error is also saved to internal variables ActionLastErrorId and ActionLastErrorDesc.