trapping errors

05-06-2002, 07: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.

05-06-2002, 08: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:

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

'Your code

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

Good Luck

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum