3 Exceptions vs. other patterns of handling errors in your code
This chapter covers
- The best patterns for handling exceptions
- Exceptions from third-party libraries
- Exceptions in multithreaded and async code
- Exceptions in functional and object-oriented programs
Errors and exceptions are inevitable in our code. Almost every code path fails if something unexpected happens. Imagine that you are executing a simple addition of two numbers. At first glance, such a code path cannot fail. However, you need to be aware that your program executes in some context. For example, you may get an out of memory error if there is not enough memory to run any operation on your machine. You may get an interrupted exception in the multithreaded context if your code ...
Get Software Mistakes and Tradeoffs now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.