Exception Handling

Hi,

I have developed one service in which may throw exception at varoius levels. Before i send all these exceptions to client, i want to store all these exception in some variable and once service execution get over, i will send an email. I mean i want to create a collection of exceptions and then will send them in bulk.

Please advice whats the better way to get this working.

thanks
Atul

There are various ways to achieve this but, the simplest will be to put a try catch around every statement or block you want to catch exception and wrap them. It goes like this

Flow Detail

1 SEQUENCE (FAILURE)
1.1 SEQUENCE (STEP 1 (SUCCESS) - Try / Catch)
1.11 SEQUENCE (FAILURE - Try)
Do something here
1.12 SEQUENCE (DONE - Catch)
Get last error and wrap it up in a structure
1.2 SEQUENCE STEP 2 (SUCCESS) - Try / Catch
1.21 SEQUENCE (FAILURE - Try)
Do something else here
1.22 SEQUENCE (DONE - Catch)
Get last error and wrap it up in a structure

 1.3   SEQUENCE STEP 3 (work with your errors)