Enterprise 11: Error handling

Because bots are typically used on an unattended computer, no one is available to click OK to continue processing when an error occurs. Use the Begin/End Error Handling statements to gracefully handle error dialogs.

When added to a task, the Error Handling allows us to gracefully handle any errors that occur.

Handle errors as follows:

  • Take Snapshot: It saves a snapshot of the screen at the moment of the error. A screenshot is sometimes the best way to determine the cause of an error when running on an unattended Bot Runner.
  • Run Task: Starts a new Task when an error occurs. This Task can do functions, for example, cleaning up temporary files.
  • Log Data into File: Writes a new log entry into the specified log file. This log entry can also contain a time stamp, which is useful for determining exactly when the error occurred. Using the system variables for $Error Line Number$ and $Error Description$ provides useful data for the log.
  • Send Email: Sends an emailed error report which can contain a screenshot of the error (see Take Snapshot) and variable values to help troubleshoot the issue.
  • Variable Assignment: Sets a value to a specific variable. This is useful for tracking whether an error occurred in the task, then doing other events, for example, logging task successes and failures.
  • Set Task Status: Reports a Fail or Pass condition to the Control Room on an error. The Pass condition is useful when an error condition is expected but you want to ignore it and continue.

Bot Store requirements for error handling

Every bot submitted to the Bot Store must have an error handling mechanism and an error folder structure as follows:

  • Create an error folder in the following location:
    <AAFOLDER>\MyTasks\Bot Store\<DigitalWorkerName>\ErrorFolder
  • Under the ErrorFolder, create two subfolders:
    • Logs
      <AAFOLDER>\MyTasks\Bot Store\<DigitalWorkerName>\ErrorFolder\Logs
    • Snapshots
      <AAFOLDER>\MyTasks\Bot Store\<DigitalWorkerName>\ErrorFolder\Snapshots
All bot code must handle errors as follows:
  • Capture error windows.

    Save error window snapshots to the Snapshots folder.

  • Log error messages, including a time stamp, to the Logs folder.
Important: .Bot submissions that do not follow error handling requirements are rejected.

In Digital WorkerNaming conventions, you learn about naming your Digital Worker and the accompanying files.