AnsweredAssumed Answered

Is one Try/Catch shape sufficient to catch all Salesforce errors

Question asked by DarrellFlenniken9941 on Mar 15, 2016
Latest reply on Mar 21, 2016 by DarrellFlenniken9941

Assuming that my Salesforce updates and inserts are in sub-process calls is one Try/Catch shape in the main process, superior to all branches, sufficient to trap errors but allow the integration to proceed down all branches and not abort on the first error? I have both inserts and updates and would like to allow retries for things like locked records and not have the entire integration fail. Or, do I need to implement Try/Catch in each sub-process for retries.

 

It looks like retries at the superior or top-most Try/Catch will retry everything below the Try/Catch in the process tree.

 

It seems to me that I need one Try/Catch at the beginning of the process without retries to trap and log all unhandled errors but use Try/Catch in subprocesses with retries that perform the updates or inserts. After nested retries are exhausted will a nested Try/Catch return to the superior or  top-most Try/Catch?  Is this the correct design pattern?

Outcomes