exception.Source.ToString not give me the exact activity name (?)

my smtp have error exception like this, the Source is written as “Send SMTP Mail Message” :

but the Source in my message box with the exception.Source.ToString is written as:
2

what is the correct syntax if exception.Source.ToString is wrong?

@wija

You would get the correct source only when the activity is inside a workflow and a try catch is used on the invoke workflow from a different workflow…

If the try catch is used in same workflow then the exception activity type is given as source instead of the name of the activity

So include your send mail in a workflow and invoke it in another and use a try catch on invoke workflow then you would see the source as needed

Hope this helps

Cheers

oh wow, this is pain in the ass, this mean i have to put so many try catch. Because my main workflow is invoke sendMail.xaml more than 1 flow direction.

i will just replace the exception.source as hard code: “SMTP activity”.

@wija

You need not have many…but yes its little wierd…

So one layer of invoke is needed for sure…under that you can have any numner of invokes amd if you have a try catch on the outer most layer then it shpuld show sorce for all the activities inside any invoke workflow under that layer

Or as you said yes you can use hardcoded values

Cheers

i have more than 1 invoke sendMail.xaml inside my main.xaml,
so i have to put more than 1 try catch to surround my invoke sendMail.xaml inside my main.xaml.

^ this is pain in the ass for me.

But your tips is helpful for my getMail.xaml because this xaml is only invoked only once inside my main.xaml.

this is the solution for now, but not efficient for some cases.
UiPath should fix this asap

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.