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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
HP to Microsoft: Thanks for Nothing
iPhone Remains Left Out as Android Scores Flash
The Year of Living the OpenSocial
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.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

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

webref The latest from WebReference.com Browse >
Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script · Book Review: Content Rich
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Gateway Launches New Core i7-powered FX-Series Gaming PCs · Review: Lenovo ThinkPad SL300 · EBay, Alternative Site Holiday Resources for Sellers