17.5 When to Use Exception Handling
Exception handling is designed to process synchronous errors, which occur when a statement executes, such as invalid function parameters and unsuccessful memory allocation (due to lack of memory). Exception handling is not designed to process errors associated with asynchronous events (e.g., disk I/O completions, network message arrivals, mouse clicks and keystrokes), which occur in parallel with, and independent of, the program’s flow of control.
Complex applications normally consist of predefined software components (such as classes from the Standard Library) and application-specific components that use the predefined components. When a predefined component encounters a problem, that component needs a mechanism ...
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