Thoughts on Exception Design
Before getting into the details of exception design, consider a facet that the simple examples in this chapter cannot communicate. Your overall exception handling strategy should guide the design and handling of your exceptions at the lowest levels. At least a napkin sketch of your exception handling architecture goes a long way to save you pain in the future. The following are some questions to consider.
• Will you handle exceptions at the top-most boundary layers such as UI, API, and service interfaces (my recommendation) or at lower levels in a more ad hoc fashion?
• In languages like Java in which the distinction is relevant, should you implement exceptions as checked exceptions that are declared as part of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access