Error (Exception) handling.(Power Automate Desktop)
This section describes how to Error (exception) handleing in Power Automate Desktop.
If an error occurs, the flow terminates abnormally at that point.
However, if you want to take some Action such as "continue without terminating" or "keep a record of the abnormal termination," error processing is necessary.
There are two types of error handling: those set for individual Actions and those set for multiple Actions.
In general, error handling can be set for individual Actions, or for multiple Actions at once.
Basically, it is recommended to set them all together, and then set the ones that are not enough to each Action individually.
Set for multiple actions
Drag On block error from Flow control to the Workspace.
Save the file with an arbitrary name.
The name can be blank, but it is recommended that the name correspond to a cohesive set of actions, if possible.
The On block error and End will be added.
Actions are added in this section.
The Error handling set in On block error will be applied to all Actions in it.
Then double-click on On block error to open it and set up the Error handling.
Continue flow run and Throw Error
The initial status is Throw Error.
Since the flow will terminate in the event of an error as before Change the setting to Continue flow.
Then select Exception handling mode.
|Exception handling mode||Description|
|Go to next action||The flow continues, ignoring the action in which the error occurred.|
|Repeat action||After 2 seconds, perform the action that occurred again.|
It continues until the action succeeds.
If you want to wait longer than 2 seconds, you can use the New rule subflow
Wait" action in the New rule subflow to extend it.
|Go to label||Move to any Label position.|
Label is placed from within Flow control.
However, a flow that moves to multiple Labels is very difficult and deprecated.
If you do use it, place the label only at the end of the Flow.
|Go beginning of block||Start over from the first Action in On block error.|
|Go to end of block||Ignore the action in which the error occurred and the action in progress.|
Move to the End block of On block error.
Select from New rule.
This rule is executed before moving on from the action that generated the error. It is also executed on a thrown error without continuing.
Multiple of these rules can be set, and they are executed in order from the top.
For example, set the following variables
- The body of the error message.
- Flags in case you want to change the subsequent processing depending on the presence or absence of an error.
- Temporary settings when an error occurs. The number to be used in subsequent calculations, such as -1 or 0.
Select the sub-flow to execute in case of an error.For example, the following process is performed.
- Display error messages
- Record errors in a text file (error log)
Error information can be obtained from the Get last error Action in the subflow.
Error messages and other information can be retrieved from this error information.
Error messages are retrieved with %LastError.Message%.
Capture unexpected logic errors
Without checks, calculation errors such as 1/0 (zero division) would be unexpected errors and could not be handled as exceptions.
However, when checked, it becomes possible to handle such errors.
We recommend that you check this box.
Set for individual actions
Error handling can be set for individual actions by clicking on On error in the lower left corner of the action.
Specify error handling here.
Settings other than slow errors take precedence over those set in On block error.
Retry action if an error occurs
If ON, the action is executed again when an error occurs.
Specify additional retry Times and Interval.
Continue flow run/Throw error
The default setting is Throw Error.
Change it to Continue flow run and specify the detailed behavior.
We do not recommend any setting here other than Go to next action.
In particular, Go to label is inconvenient for the readability of the flow, so it is better to use a subflow with New rule, which is described later.
As with the same item in On block error.
Set variable or Run subflow is specified.
When Advanced is opened, settings can be made for each error situation.
This can be used for error processing according to the action or error status, or for displaying error messages.