Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

err object with 'on error resume next' 1

Status
Not open for further replies.

sharedworld

Programmer
Dec 25, 2003
65
US
I'm looking for a script like this: 'on error resume next' on the begining of the page, and then every time there is an error is saving the error let's say in a array or writing it with response.write.

I mean to say, that just after the declaration 'on error resume next' should be some declaration like 'on error response.write err.number'... or something like this. thank's
 
If you use On Error Resume Next you will have to write code yourself to check the errors similar to the following:

On Error Resume Next
'Do something here
If Err.Number Then
Response.Write Err.Number & Err.Description
Err.Clear
End If

If you use On Error GoTo Label, you could do the above in one place with code similar to the following:

On Error GoTo ErrorHandler

Your Code

'Just before label so code does not drop into it
Response.End
ErrorHandler:
Response.Write Err.Number & Err.Description
Err.Clear
Resume Next

In the above case, any error(s) will cause the code to transfer control to ErrorHandler where it will be written, cleared and then the code will continue with the next line after the line which caused the error.

Hope this helps and good luck!


Have a great day!

j2consulting@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top