[Previous] [Contents] [Next]

Designing Your Code with Exception Handling


So far, we've covered the basic concepts of using exception handling and the semantics related to the throwing and catching of exceptions. Now let's look at an equally important facet of exception handling: understanding how to design your system with exception handling in mind. Suppose you have three methods: Foo, Bar, and Baz. Foo calls Bar, which calls Baz. If Baz publishes the fact that it throws an exception, does Bar have to catch that exception even if it can't, or won't, do anything with it? How should code be split with regards to the try and catch blocks? -

[Previous] [Contents] [Next]