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

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
129 active users
1860 visitors today
2317 pages today
(only part of today)
Tools I use

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

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

Displaying the exception...

The DatabaseException function simply displays the error message using the description property of the Error object as shown below...

function DatabaseException ( e )
{
   Out ( 'An error has occured while connecting to the database:' );

   Out ( '<p>"' + e.description + '"' );

   Out ( '<p>Don\'t despair - this problem is probably well-documented in my <a href="http://CoverYourASP.com/Trouble.asp">trouble-shooting</a> section.' );

...then sends an email to BadDB@yourdomain.com describing the problem. I'm hoping never to get one of these emails from the CoverYourASP site!

   // make up the message body
   var sBody = 'The file "' + sURL + '?' + Request.QueryString ( ) + '" generated a database error\n\n';

   sBody += sMessage;

   // send the email
   SendEmail ( 'Database.Exception', 'BadDB@' + sHostDomain, '', 'Reporting exception', sBody );
}

Featured sponsor
My favorite resources

Tiki Statues - Tiki Masks - Tiki Totems



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!


I share my content

Supporting ASPRSS

Do you need a quick and easy way to link to my articles? All the information you need is published with ASPRSS...