spacer
Yehuda Shiran September 16, 2002
Throwing Exceptions to the System
Tips: September 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Going Native With Chrome
Mozilla Fixes Firefox Flaws as 3.5 Release Nears
Microsoft and Novell Still Bosom Buddies

If you omit the catch block, the system will catch the thrown exception and will attempt to open an application of your choice for debugging the error. The following code sample includes an inner try...catch...finally statement embedded inside the try block of an outer try...finally statement. Notice that the outer statement does not have a catch block:

  try {
    print("In outer try block...");
    try {
      print("In inner try block...");
      throw "Error 325 from inner try block";
    } 
    catch(e) {
      print("Inner catch block caught " + e);
      throw e + " re-thrown from inner catch block";
    } 
    finally {
      print("In inner finally block...");
    }
  } 
  finally {
    print("In outer finally block...");
  }
Here is the window you would get:

To avoid such windows, always catch exceptions yourself.

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:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
XML and PHP Simplified · Creating a ASP.NET Contact Form · Data Filtering with PHP
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Intel to Host Live Nehalem Q&A · 12 Tips to Troubleshoot Network File-Sharing · 10 Tips for Selling on Kijiji