TryCatch Issue

Hi, I am facing issue, here in the first sequence I am reading an excel which is corrupted so it’s executing the Catch Block fine. In catch I defined SystemError = exception
But in the next I given the Flow Condition I don’t want to continue I want to execute the Right activity false to stop the process. If my excel is fine so my Catch won’t execute so in that case I want to left which Is True.
So my question is SystemError is not accepted in the flow condition because it’s not a boolean type.
If I take the boolean type SystemError and assigned in the Catch Block like
SystemError = False
in that case it’s not executing because it’s not find where is the error Right as error in our Excel itself. So can you help on this,

Simple que what condition I give in the flow if my catch execute then I want to execute the False activity if no error and Try is executing only then I want to execute the True left sided activity. As flow decision accepted boolean type only. If I use the boolean type in Catch block it will not catch the error because it’s a system exception error right. Plz help

@Palaniyappan @Lahiru.Fernando @lakshman @KarthikByggari @HareeshMR

1 Like

Instead of taking the exception as value to SystemError we can take a Boolean value like true or false like once it reaches to catch block assign the SystemError values as A Boolean
so the flow should be like this
–in the try catch activity, include the assign activity with SystemError with Boolean value as True, (where the default value of systemerror is false defined in the variable panel as global variable with scope as whole sequence)
–so when the process reaches the catch the variable SystemError will be assigned as True
–next in the flow decision put a conditin like
SystemError= True
so here we need to change the direction along with the current process (as per your image)
–so if its true it should go to message box with value as “Stop”
–or if its false it should go to message box with value as “Continue”

simple isn’t it
Cheers @balkishan

2 Likes

Hi @balkishan,

Create a System.Exception Variable (i.e SystemErr) and Assign it in Catch Block (i.e SystemErr = exception). Also check the condition like below

SystemErr Is Nothing

1 Like

Create a variable of type Boolean outside the try catch block and assign it to false value @balkishan,

Once you got the error, in the catch block , change the value of the variable to false and pass it to flow condition …

image

1 Like

Hi @Palaniyappan I assigned SystemError is False in default variable panel. In the Catch Block I assigned it to True. I didn’t put/assigned anything in the Try Block. But it’s not working wheather my excel correct or corrupted it’s always going into the True condition. Tell me If I miss anything here in the Try Block

1 Like

But in the Catch block you have assigned True bro?

1 Like

I think its getting corrupted with the excel
try to print the value of systemerror in the catch block with a write line
–next to the assign activity use a write line inside the catch block and mention as
SystemError.ToString
lets check that

and make sure the scope of the variable is with whole sequence making it as a global variable
Cheers @balkishan

1 Like

Yes, you need to assign it to true as the error is there in the flow. If there is no error, then erroroccured is false.

Based on that, change the flow decision

1 Like

It executing the Catch since my excel is corrupted but why it’s going into the True(Continue) process???
image

1 Like

kindly have a look on this buddy
i suggested to change the flow decision
you were almost done
just we need to change the place of message box

Cheers @balkishan

1 Like

Thanks @HareeshMR @Palaniyappan it’s resolved bro

1 Like

Fantastic
Cheers @balkishan

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