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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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 >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint