(Try Catch exception)

Hi ,

when we put some particular code in try catch block for catching the exception if any exception arises .

Do we still need to correct the code in catch block after exception (ex: Closing the application)

or just leave it ,as we have written some exception in catch block.

Thanks in advance

Hello @saritha,

In catches, depending on the error you are getting, if you know how to solve it, insided the catch you can put code to solve the error. Otherwise, you can put there to close application. If you do not put in catches, you need to call the system error to another state to close the applicattion (This is when you are using Reframework).

If you are not using reframework I recommend to you to put the close application inside the catch. :slight_smile:

Hi, thanks for ur reply. didn’t get it clear

I’m not using REframework

I will just catch an error using System.Exception or a specific exception.

Do I still need to write the code for closing application.

Thanks in advance

1 Like

Hey @saritha

Yes you need to write it (the close applications) which is a best practice.

But kindly make sure that doesn’t cause any errors.

Thanks
#nK

ok Thanks for ur reply.

So, if we didn’t correct our code, it just won’t stop the execution and if exception arises it will be caught as we have given it in try block.

Am I correct.

1 Like

Hey @saritha

Yes, The program will stop after the exception is captured.

But the applications will remain open which may be not be the right thing.

Also before beginning the process, you need first kill all the process related to your automation as a best practice to avoid any conflicts.

Hope this helps

Thanks
#nK

1 Like

Thanks for ur reply

1 Like

Cool @saritha :slight_smile: :+1:

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