Skip to main content
Became Hot Network Question
Tweeted twitter.com/StackSalesforce/status/1511448602882842631
edited tags
Link
Kris Goncalves
  • 22.8k
  • 8
  • 35
  • 72
Source Link

What can be achieved with Finalizers that was not achievable before?

I have gone through the documentation and read the examples and use cases. However, I am still struggling to understand how Finalizer add value and what can we achieve with it that was not achievable before, for example, by using a simply try-catch-finally statement.

Example: in the same way that we attach a finalizer to the job execution, and we check the result whenever it is finished, we could execute the ParentJobResult.SUCCESS logic at the end of the execution logic or the ParentJobResult.UNHANDLED_EXCEPTION in the catch block if anything is thrown.

Is the only purpose to be able to catch any exception that is not catcheable, such as assertions or TOO_MANY_SOQL_QUERIES?