Ging to exception

Hi Everyone,

i am struggling with some logic, i have written one logic that if that occurs bot should throw the exception and go to end state and send the email, but if that doesn’t occur it should simply logut from the application.

But just trying to check that if condition and stops there, which is wrong.


Bot should not checks this condition if there is no exception.

Hi @Rakesh_Tiwari

I think that you can create another variable to work as “flag”, if any excepcion appear you can save the message if that variable. Then in your if activity don’t validate the message, just validate if the variable contains some text, if so, it means that an exception was thrown, if not, it means no exception appeared. Use the below code to validate if your variable contains any value or not

String.IsNullOrEmpty(FlagVariable) OrElse String.IsNullOrWhiteSpace(FlagVariable)

Regards!

Hi @Rakesh_Tiwari

Try Catch
Try
   -- Your main workflow here

Catch SystemException
   If (exception.Message.contains("No Data Available at this time in Markview"))
      Send Email
   Else
      -- Log out from the application

Hope it helps!!

sorry, i am not getting. i will explain my case.


in the above image, i am trying to check the text in application and if it matches, then it will throw with same messgae and this written in initallapplication state and it goes to end state which it is checking in if condition (img already shared in above chat) that same message is coming or not, then if it is there it should send an email, but there no exception occured while running the Bot and still it is trying to check the if condition.

Suggest me the solution in detail way, how should i write the logic please.

@Rakesh_Tiwari

Change systemexception to system.exception

new System.Exception("No Data Available at this time in Markview")

image

In Catch block of try catch, give an if condition

Catch SystemException
   If (exception.Message.contains("No Data Available at this time in Markview"))
      Send Email
   Else
      -- Log out from the application

Hope it helps!!

ok, i changed to system.exception. but here i am not writting in try catch.

what i am doing is , if this exception occurs, bot is going to end state where it is checking for the exception in if condition, so what should i do, should i use try catch here

or it will handle in end state?

@Rakesh_Tiwari
Use try catch for this sequence.
In the catch block use rethrow activity

In the end state of catch block

Catch SystemException
If (exception.Message.contains(“No Data Available at this time in Markview”))
Send Email
Else
– Log out from the application

or

Scenario:2
Use try catch for this sequence.
In the catch block of this sequence you handle

Catch SystemException
If (exception.Message.contains(“No Data Available at this time in Markview”))
Send Email
Else
– Log out from the application

Hope you understood @Rakesh_Tiwari

this is written in initallaplication state and this state is surrounded by try catch and used rethrow activity.

@Rakesh_Tiwari

Okay and then follow below

No need to go into the End State.If system exception occurs it will go in the transition of system Exception.So,Go into the System exception trans and give the if condition and send email.

Hope it helps!!

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