Deciding When to Use Recovery Scenarios

If you can predict that a certain event may happen at a specific point in your component, it is highly recommended to handle that event directly within your component by adding steps such as If statements in user-defined functions, rather than depending on a recovery scenario.

For example, if you know that an Overwrite File message box may open when a Save button is clicked during a run session, you can handle this event with an If statement in a user-defined function that clicks OK if the message box opens. Handling an event directly within your component enables you to handle errors more specifically than recovery scenarios, which by nature are designed to handle a more generic set of unpredictable events. It also enables you to control the timing of the corrective operation with minimal resource usage and maximum performance. By default, recovery operations are activated only occur after a step returns an error, which can potentially occur several steps after the one that actually caused the error. The alternative, checking for trigger events after every step, may slow performance.

You should use recovery scenarios only for unpredictable events, or events that you cannot synchronize with a specific step in your component. For example, a recovery scenario can handle a printer error by clicking the default button in the Printer Error message box. You cannot handle this error directly in your component, since you cannot know at what point the network will return the printer error. You could try to handle this event in your component by adding an If statement in a user-defined function immediately after the step that sent a file to the printer, but if the network takes time to return the printer error, your component may have progressed several steps before the error is displayed. Therefore, for this type of event, only a recovery scenario can handle it.

No comments: