Any operation invocation may throw a run-time exception (see Section 28.10) and, if the operation has an exception specification, may also throw user exceptions (see
Section 28.9). Suppose we have the following simple interface:
Typically, you will catch only a few exceptions of specific interest around an operation invocation; other exceptions, such as unexpected run-time errors, will usually be handled by exception handlers higher in the hierarchy. For example:
This code handles a specific exception of local interest at the point of call and deals with other exceptions generically. (This is also the strategy we used for our first simple application in
Chapter 3.)