Chapter 4: Exceptions and Exception Handling
So far, we have spent a large amount of time discussing the causes of errors and how to develop solutions with Apex in a more defensive manner, to avoid them. In Chapter 1, Common Apex Mistakes, we discussed some common Apex mistakes that can lead to errors and how they can be proactively avoided. In Chapter 2, Debugging Apex, we looked at how we can debug and troubleshoot errors to find and eliminate them from code quickly and repeatably. In Chapter 3, Triggers and Managing Trigger Execution, we focused on triggers and used trigger handler and execution management to effectively control our triggers and avoid some of the common issues that occur within trigger development.
Sadly, it is a fact that no matter how well we develop code, we will at some point have an exception occur within our code. One of the nuances with Salesforce as a platform is that this can happen many months or even years after the code has been deployed, having worked...