|
September 17, 2002 Nesting the try...catch Statement Tips: September 2002
Yehuda Shiran, Ph.D.
|
|
Let's look at another example that illustrates the multiple nesting levels of the try...catch...finally statements. Here is the code:
Notice that the finally statements are omitted, as they are only optional. We define the function TryCatchDemo() to act differently if its argument is null or not. If the argument is null, the error is handled in the inner catch block. If the argument is not null, the exception is handled in the outer catch block.To learn more about exception handling, go to Column 118, JScript .NET, Part XII: Exception Handling.
People who read this tip also read these tips: Look for similar tips by subject: |