Handling multiple error at same time

Hi,
I have a query, I am automating a website, But I have to handle many exception, like if page not loading properly, or website down, credential exception, I am putting ID also I have to handle there exception also, so How can I have handle this multiple exception in one workflow.
@Palaniyappan

2 Likes

Hello @balkishian,

You can define many "Business Rule Exception"in a try catch and when you notice that you have one of those exception you can use the Activity “THROW” with the Value: new BusinessRuleException(“NAME OF YOUR EXCEPTION”) and therefore handle it.

Kind regards,
Daniel

1 Like

Thanks can you show me in a sample,

But in one TRY can I define all the activity for whole website,
or you suggest me that like for opening website only to put in a one TRY block and handle that exception, for inserting credentails in second try catch, Please suggest.

1 Like

Depends on how you want to configure your code and if you need the process to continue after an exception.

I would do a state machine that contains the login and retries 2 or 3 times in case the first one failed, then i would continue navigating through the website.

You can find some Business Rule Exception and documentation ijn the following post:

Kind regards,
Daniel

We can use Try catch activity
Where the sequence of activities are to be placed in the TRY block of try catch so that if exception occurs it will get into Catch block where we we again place the same sequence of activities that we had in try block so that it will repeat the same steps if that got failed in the try block
Still if that sequence in the catch block didn’t work then the exception that occurs will be caught by the catch block itself and at last we can add a note like send mail that the bot got failed due to this error

Hope this would help you
Cheers @balkishan

1 Like

Hi Thanks Palani,
But bro,
Like first I have to open the browser and inserting the URL so here I have to handle the exception, like if website is down or not open the browser

  1. Once one the browser then we have to put the credentials also, so here also I have to handle it.

  2. I have to put the employee ID sometime it’s not working or not reach to the ID page here also I have to handle,

So would you suggest me, Can I use one TRY Catch block for this whole process, OR I have to use one TRY catch for browser opening and second TRY Catch for Credentials,

Please suggest me Bro

1 Like

This looks like a micro management of exception
Fine
In that case create workflow for each individual process and inside each process use try catch activity and in try block keep all the activities to be executed and place again the same set of activities in catch block so that it will get repeated even if it fails
May in addition we can keep the activities inside the RETRY SCOPE in try block and even after that if it fails then we can keep the set of activities again in catch block without retry scope

Then Repeat the same for each individual process so that we can handle exception for each process

Cheers @balkishan

1 Like

Yah of course buddy
Inside the try block we can keep retry scope activity to ensure that the process is retired two to three time even before getting catch block
Mean while when the process fails in TRY block it will get into catch block where we have these set of activities again so that we can try again executing the same process once
Even if that fails then we can use a send outlook mail activity at last in the catch to send a note to user that the process failed at this point

cheers @balkishan

1 Like

Okay understood bro,
Last question, suppose the process fail in TRY block then it go to the Catch block, if In catch block it successful executed then in Catch block we have set the send message right, so after successful execution in Catch block it will send a message is it?

1 Like

Ol got it
So let this sequence be in catch block
—use a sequence
—at first use a assign activity like this
bool_success = False
—and then being in a sequence have another sequence of activities we need inside it and at last inside this sequence use a assign activity like this
bool_Success = True
—then next to this inside the FINAL Block of TRY CATCH ACTIVITY use a IF condition
bool_Success = True
If true it will go to THEN part where we can have our send mail activity with success message that is the process in the above sequence inside the catch completed successfully
Or if that fails in the middle of the activities inside the catch block, the first assign inside the catch will store the Boolean as False so it will go to ELSE part where we can have our send outlook mail activity with failure message

Where bool_success is a Boolean variable defined in the variable panel with default value as TRUE

Cheers @balkishan

1 Like

Kindly let know for any queries or clarification
Cheers @balkishan

1 Like

Hi Palani
Can I use Try Catch Activity inside another Try Catch.
As I have used, My exception is Try Block of Circled Marked Try Catch Activity. Now it’s printing the Catch Block Circled Try Catch Activity it’s fine.

But if we see now the exception is in Try Block of arrow marked Try Catch. So it’s Catch Block should also executing na which I marked but it’s Catch is not executing. Please tell me am I doing right?
image

Bcz I have to handle the multiple exception, In the same sequence. I can create multiple sequence but my Adnic sequence will be one only.

1 Like

sorry bro didn’t get this ?

Now we have one try catch activity say 2 inside another main try block say 1
Now we would have included all the activities inside the try block of 2 so if any exception occurs it will get into the catch block of 2 only as we have a catch in that itself
It won’t get into the catch block of the main try catch 1

cheers @balkishan

Hello Sir, You said this is “Micro management of exception”. Is this an incorrect approach to handling exception?

of course it is, but he has a chance of getting failed at each step…thats why @Jainam_Shah
even i have suggested to keep them as separate workflows ie., separate xaml wherever he feels it may fail…

Cheers

Actually Sir, even i am running a workflow where in one particular sequence, i have business exceptions for each type into activity. Hence, i have used try catch and terminate workflow in case of any exception. Would that be fine too?

are we trying to terminate workflow…thats fine only if we have made some amount or retry…if thats the case then fine @Jainam_Shah

Yeah. Cannot put retry. Its business rule exception. It shouldnt process ahead if error.

1 Like

yah even for business exception we can retry with the transition by routing the process back from Process state to Get Transaction State.

Cheers @Jainam_Shah

1 Like