Wife/Girlfriend/Sister?
Pepper Spray &
Stun Gun Specials!
KEEP THEM SAFE.
 CoverYourASP --> Handling exceptions when opening database --> Part 3

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
71 active users
1240 visitors today
2407 pages today
how is this done?
Tools I use

CoverYourASP
Copyright © 1999-2010 James Shaw.
All rights reserved.

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

But what is "e"?

What is tricky with JavaScript exception handling is that you aren't told what type of object e is.

In my case I know, because there is only one statement to go wrong in the try block. It's going to be an ADO Error object.

To execute different code depending on the object type, you can use instanceof as shown below, or do like I did and just dump the exception to see what it was:

catch ( e )
{
   // find out what exception was thrown
   if ( e instanceof Error )
   {
      // it's a Error object, so you
      // can treat it like one
   }
   else
   {
      // no idea, so let's dump the properties
      for ( var p in exception )
         Out ( p + '=' + exception [ p ] + '<br>' );
   }
}

Part 4: Displaying the exception...

Featured sponsor
My favorite resources

Tiki Statues - Tiki Masks - Tiki Totems



Qualify for Free Trade Magazines

Free subscriptions to industry leading publications for those who qualify!


New Proposal Kit Professional 5.1
Brand yourself as a top professional: create quotes and amazing proposals and get many legal documents free!

The latter saved me 3 times the purchase price on the first day I owned it!