I was surfing the web to see how others are doing error catching and the following caught my eye:
Private Sub Class_Initialize
sLogFile = "C:\temp\testforerror.txt"
Private Sub Class_Terminate
'If Err Then RespondToCrash
Private Sub RespondToCrash
Dim oFS, oTextFile
Set oFs = Server.Createobject("Scripting.FileSystemObject")
Set oTextFile = oFs.OpenTextFile(sLogFile,8)
oTextFile.WriteLine "Err = " & Err & ", Err.Description = " & Err.Description
Set oTextFile = Nothing
Set oFs = Nothing
Now just at the top of every page, you can do this:
Set oErrorTest = new TestForError
This was posted by experts-exchange member sybe. I really like the idea of doing it this way, but what if there is more than on error on this page. Is there a way for this script to log all of the errors?
In addition to that, is there a way to do it without adding On Error Resume Next?
The reason I like the idea of using the class is so I do not have to manually add checks in everywhere to see if there has been an error. I can just place that code at the top of the page and be done with it.