Padding Padding
Janet
Systems
 Register  Login 
Telephone  01628 566 178
Website Design, Hosting and Software Services
  Search 
Padding
corner Padding corner
Padding Padding
corner Padding corner
 ASP Articles

After everything else is done with your new piece of asp code, what about errors? No matter how much time you have spent checking through your code there is still the possibility of a logic error, or maybe someone using your program can induce an error.  System error messages can easily be trapped and turned into something which looks more preplanned and easier on the eye.

To trap errors we add <%on error resume%>at the appropriate place in the code, usually at the start.. I have found before that it has been necessary to place this at the start of a subroutine.

Next after each section of code which is likely to cause an error, for example database connections, add the following:

If Err.number <> 0 then  errorTrap   'if there is an error

And later in the code:

<%
Function errorTrap
    response.write ("Sorry you have encoutered an error."  & "<br>")
    response.write ("Your error number is " & Err.number  & "<br>")
    response.write ("The error source is " & Err.source & "<br>")
    response.write ("The error description is " & Err.description  & "<br>")
End Function
%>


This article viewed: 974 times Back

Copyright © 2004-2007 Janet Systems Ltd.

 Print   

DotNetNuke Website design and hosting from £15.00 per month. More...

Looking for a website design company in the Thames Valley, call us on 01628 566178

DotNetNuke Modules
DotNetNuke Modules availalble from Janet Systems

DotNetNuke Skins
DotNetNukeSkins.gif

from Janet Systems

Padding
Copyright 2002-2008 Janet Systems Ltd.   Terms Of Use  Privacy Statement Tuesday, May 13, 2008