How to use Try Catch

Hello,

I am using Try Catch first time in my project, for that I right click on solution and select Surround with Try Catch after that got the below message.
can anyone please advice on this.

1 Like

Add a new catch as it states, this may be a System.Exception for example or something more specific. You can then start adding remedial actions to the exception that is caught.

1 Like

Fine
TRY CATCH can be used if we feel or get like some exception when an activity along the process if executed might give error or might not at some times
so to handle that exception we are using TRY CATCH like how we do in the programming language

–then for that keep that activity or even sequence of activities inside the TRY BLOCK and if that throws error it will be caught by CATCH Block and it will go to CATCH block where we can use LOG MESSAGE ACTIVITY and mention like this
Exception.Source.ToString to know which activity was throwing error
and
another one for exception message
Exception.Message.ToString

and followed by that if we want we can even place the same set of activities or any other alternative sequence of activities to handle that exception in the CATCH BLOCK

and while choosing the exception type choose mostly System.Exception in common as it take any exception or if we know the exception that would occur then we can search for that exception and choose accordingly

and FINAL block if any activity is mentioned it wll get executed regardless of an exception thrown or not, or catch block is executed or not
so we need to include activity in FINAL only if needed as it will get executed for sure

Hope this would help you
Cheers @nm09011985

9 Likes

Hi,

I have only one flow chart in my project so I cannot drag the same activity into Finally , can you please advice what i need to put into Finally.

image

Place your remedial actions in the Catches section, under the catch that is applicable. In this case, your general Exception catch.

image

It might because of have no any action in the “Finally”.

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