In an earlier post, we explored Automation Anywhere’ s error handling capabilities.
Today, we are going to dig a little deeper and refine our Error Handling Process.
You May Log Errors in One of Two Ways
One is by haphazardly outputting everything onto notepad, while the other is by outputting details into the right file, in uniform format.
Of course, errors can only be logged if it is enclosed inside of a Catch Action.
But that is just the setup.
What will our output look like?
Lets test that out.
Lets try imparting some uniformity to it.
Oh would you look at that. It still retains its Neanderthal-ish qualities.
So how do we resolve that, and give it the makeover it so desperately needs?
By Dumping Notepad To Where It Belongs
Which is in the stone age.
Its difficult, if not impossible, to impart structure to a notepad, which is why we are not going to attempt the impossible.
We are instead, going to rely on CSV Files.
Comma Separated Values To The Rescue
CSV Files are very much similar to Excel workbooks, but they are only useful for storing data.
CSV Files however, cannot save formats. If you apply Bold, Italics or word-wrap functions to your CSV, it won’t save it.
It simply stores your data as comma separated values.
The values separated by commas are row items, while newlines indicate the next column.
You will see this when you open your CSV File as Notepad(by replacing the .csv with a .txt)
How To Log Errors to CSV
If you wish to append a timestamp, you can’t.
You may only Prepend the timestamp. Most of you won’t get this.
Also, if you wish to divide data into separate columns, you have to structure the inputs as follows:
Edit: Note, we have enclosed the error message within quotations. This is done to prevent our CSV file from CSV-ing our error message into bits when it contains commas.
Once that’s done, the errors will get filled up nicely along the structure you have provided.
The reason we separate the values with commas, is because the values are being fed into a Comma Separated Values File.
And with that, you have learned how to log errors like a professional.
Test it out, and see if you can make some improvements to whatever I have detailed above.