I have a sequence that has some terminal activities along with UiAutomation activities. I’d like to be able to specifically capture any terminal errors. But when I add a new catch and go to the window to select it, I don’t see anything for “terminal”:
My desired result is to have three catches:
Business Rule Exception
System Exception
Terminal Exception
I forced an exception from Terminal Session and this is what I got:
System.Exception doesn’t help. I need to be able to separate exceptions thrown by terminal activities from other exceptions. In order to name the source I’d have to first identify that it’s a terminal error. If I could do that, I wouldn’t need to name the source.
Oh I thought you meant a property of the exception. That’s in interesting approach, if I name the activities with a particular standard then I could check for it.
I thought about just a try/catch around the terminal activities so I can rethrow an error up the main try/catch, because in this automation all the terminal activities are in one place. But for other automations this would be unwieldy.
You will need to create a small class library in .NET using visual studio and use it as a package dependency in the project.
Just a small glimpse below.
public class TerminalException : Exception
{
//Props
//Methods
}
So as you can see above we are creating a new Exception type inherting from Exception and you can even add custom properties and methods to it in addition to default props like Source, Message etc.
Oh, I hadn’t even considered adding to the properties of exception. That should work. I can just wrap the terminal activities in a Try/Catch, then in the Catch add the property and rethrow.
I’m not talking about setting the error message. I need an exception class something like “TerminalException” as opposed to “System.Exception” so that I can differentiate terminal errors from other errors.