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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handling not working, browser timing out

Status
Not open for further replies.

superslurpee

Programmer
May 15, 2002
108
0
0
Hi,

I have a sub that uses ADO to get results from my database and display them. It works lovely. When I add "On Error Resume Next" at the top of the sub, and

Code:
If Err.Number <> 0 Then 
        Response.Redirect &quot;error.asp&quot; 
        Err.Clear 
End If 

On Error GoTo 0

at the bottom to just redirect the user to an 'error' page when a run-time error occurs (like database connection probs or whatever), I don't get the run-time error showing (that's good), but I don't get redirected either. It just sits and does nothing. It will work fine if there's no error, but when I add one, I don't get results, no error message, and no redirect.

Anyone have any ideas what's up? Am I doing this correctly? I want the thing to work like a try catch block. If an error is encountered, jump down and find how to deal with it.

Thanks peeps!
 
On Error Resume Next tells the code that when an error occurs in a line, don't bother with it go to the next line. So it is still going through all the code between your error line and the error check you wrote above.

I couldn't tell you more about the cause of your error without seeing your code, but it is most likely one of those intermediary steps that is hanging. Perhaps you have a second call to the db based on the recordset from the first, or your looping through one of the recordsets and getting stuck in a loop before it gets to the Err check.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
No more vacation for me :(

FAQ FAQ20-2863
= new Forums.Posting.General.GettingAnswers()
 
Hi,

Thanks for the responses! That is what is happening Tarwn. It's still going thru my code and because there is no database connection (or another runtime error I've put in), it's hanging before it ever gets to the error handling section (which it would run if it got there).

Is there any way in ASP to say, if you encounter an error that you can't handle, jump down and handle it like I say! I don't want it to 'resume next', I want it to resume by handling the error! How is this usually handled?

Thanks! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top