trapping errors

aquaman
05-06-2002, 08:09 AM
Does anyone know how to trap errors using ASP? I'm awhere of "Transactions", but is there another way that ASP can trap Database errors or Run Time errors, etc? For example, if an error happens within a section of a page to display a generic message or do something else. Any help or direction to find help would be appreciated.

Rezner
05-06-2002, 09:09 AM
Well, you can use "On Error Resume Next" and then check the current values of objects and such to see if an error has occured and then display content as appropriate.

"On Error GoTo ErrorTrap" is not allowed in ASP scripts.

Alternatively, you can simulate the "goto" error trapping capabilities with:
set objerr=Server.GetLastError()

Use this page as a great reference:
http://www.w3schools.com/asp/asp_ref_error.asp

Derek Stone
05-06-2002, 09:10 AM
On Error Resume Next

'Your code

If Err Then
Response.Write "<P>" & Err.Number & " " & Err.Description & "</P>"
End If


Good Luck
-CL

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum