Undocumented activity: Throw

Hi community

I’m having the following situation:
When I’m searching something in an application, I’m able to get “not found”. Now, if it’s not found, I would like to interrupt the workflow and not process any further. For this, I have everything in the Try/Catch (in this case, in the Try-Block). Now, I would like to use “Throw” (best would be a tailored exception) or at least a system exception. I’ve seen and read this members question:

Now, on a more general note: I cannot find the “throw” activity documentation. What belongs into the field “Exception”? If I try “exception” (same as in the catch-activity), it won’t accept it (it’s declared as “String” and cannot be converted into “Type”). What’s the trick here?

You need to give there an instance of System.Exception, or anything that inherits from it, f.e.
new UiPath.Core.BusinessRuleException("Required data XYZ not found... bla bla bla...")

I’m aware about that - and I’ve done it exactly like this… however, it fails :frowning:

Throw’s source:
https://referencesource.microsoft.com/#System.Activities/System/Activities/Statements/Throw.cs,52a631d28de0c4ea,references

It’s an MS activity, so you need to look for the documentation elsewhere than UiPath - MSDN is a good source.

Works fine for me.
Can you attach your xaml/error message?

1 Like

Hi

I have a “Throw” activity with the Exception defined:
new UiPath.Core.BusinessRuleException(“bla bla bla”)

and while executing it says “Throw executing” and right after “Throw faulted” where it does cancel the sequence… I do not have a “Create exception” defined before…

Can’t replicate, sorry :frowning:
Have you tried other exception types?

Hi

it seems that “throw” is supposed to fail… where the rest is working fine. It is now throwing a businessruleexception and directing into the right “catch”-block.

Thanks for your support