What's the type to catch terminal errors?

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”:

image

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:

image

1 Like

Hey @postwick

As you can see above that is throwing System.Exception

You may use a separate try catch for it as one option.

Or you can name the source with some convention for terminal activities and based on the source in exception you can build appropriate handling flow.

Hope this helps

Thanks
#nK

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.

1 Like

The source which I was saying is the activity names which will help you identify the terminal exception.

Thanks
#nK

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.

1 Like

Yes you are right.

The rethrow approach which you mentioned above will be on of the cleaner methods as well.

May be you can create a custom terminal exception as well and do throw from that rethrow point.

Thanks
#nK

There is a way to create my own exception types? Oooohhh how do I do that?

1 Like

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.

Hope this helps

Thanks
#nK

1 Like

As an mediate approach we can use the data dictionary for marking recevied excpetions and then (re)throw the marked exception:

grafik
later we can identify e.g.
grafik

1 Like

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.

1 Like

@postwick
Use the throw activity for customize the exception.

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.