Errors¶
You can have control over the errors that occur during the execution of a task, mapping information such as code tracing, screenshots and files.
BotCity Orchestrator
You can view the Errors functionality directly on the BotCity Orchestrator platform.
See more at:
Create a simple error¶
A simple error consists of capturing only the most basic information when an error occurs.
To log an error with the SDK, you need the following information:
- Task ID: Reference of the task that will emit the error.
- Exception: Information captured from the code within
try/exceptblocks.
See an example of simple error capturing:
Create a custom error¶
You can customize the information that will be sent to the BotCity Orchestrator, including optional parameters in the error capture.
To log a complete error with the SDK, you need the following information:
- Task ID: Reference of the task that will emit the error.
- Exception: Information captured from the code within
try/exceptblocks. - Screenshot:
(optional)Path where the image was saved. - Tags:
(optional)Information inkey/valueformat stored as text. - Attachments:
(optional)List of paths where the files were saved.
Screenshot¶
It is possible to add a screenshot of the screen at the moment the error occurs, passing the path where the image was saved.
How to save a screenshot?
You can use the screenshot saving method for Desktop and web automations with the BotCity Frameworks.
See how to use it at:
See an example of an error with a screenshot:
Customizable tags¶
The default tags captured are the following:
- User: Username that triggered the task.
- Host: Name of the environment where the task ran.
- Operating System: Name of the environment's operating system.
- OS Version: Version of the environment's operating system.
- Language version: Version of the language used in the process.
In addition, you can add custom tags with information that is relevant in case of error, in key/value format.
See an example of an error with additional tags:
File attachments¶
You can attach a list of files that make it easier to understand and fix errors when they occur. These files can be of any type.
By default, the file containing the project's dependencies and their versions is attached to the error. You can add extra files by creating a list with the paths of the files to be sent.
File examples
It can be useful to attach:
- Extra images
- Code logs
- Files used during the process.
See an example of an error with file attachments:
try {
int div = 0/0;
} catch (Exception error) {
List<File> attachments = new ArrayList<>();
attachments.add(new File("/home/test/error.png"));
attachments.add(new File("/home/test/process.log"));
attachments.add(new File("/home/test/test.txt"));
maestro.createError(<TASK_ID>, error, null, null, attachments);
}