Try Catch inside of a Try

Is there a way to embed a “try catch” within a “try”?

I have a flow service with a main “try catch” statement. Within the main “try” I am implementing “pub.client:smtp”. Currently, if the email server is down, it results in an error in the flow service, and the flow service exits. However, in the event of an error related to “pub.client:smtp”, I just want the flow service to move on with the rest of the code inside of the “try”.

I’ve tried embedding another “try catch” inside of the main “try” statement; however it doesn’t appear to work. I’m on IS version 10.1.

What would be the best way to implement this? Thanks.


-main - success (outer)
--try - failure
---a=1
---main - success (inner)
----try - failure
-----smtp invoke
----catch - done
-----log error or do nothing
---b=1
--catch - done
---log error or do nothing

PFA
Try-Catch.PNG

Hi Mahesh,

Thanks for your reply. The problem appears resolved now.

Initially I tried with the inner “try” set to failure and the inner “catch” set to done; however, when the smtp service threw the error, the flow service went to exit without completing.

But setting the inner “try” to done appeared to do the trick. In this instance, I did not even need the inner “catch”. When the smtp service threw the error, the flow service moved on and completed.

Thanks,

Ken

That’s good, hope it is working as expected, you can mark this thread as “Closed” Thanks

How can I get the same functionality using the new TRY_CATCH and TRY-FINALLY available on the new Service Designer ?

Hi All,

I have below scenario for try/catch, could you please me on understanding?

1.) Seq–Main (exit on - Success)
Seq–Try (exit on - Success)
Seq–Catch(exit on - Done)

2.) Seq–Main (exit on - Success)
Seq–Try (exit on - Success)
Seq–Catch(exit on - Done)
Seq–Finally(exit on - Done)

3.) 2.) Seq–Main (exit on - Success)
Seq–Try (exit on - Success)
Seq–Catch(exit on - Done)
Seq–Finally(exit on - Success)

in above scenario catch and finally will execute or not.