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

Intercept Timeout Errors

Status
Not open for further replies.

spazman

Programmer
May 29, 2001
500
CA
I have never added error handling into the web pages I built (intranet so the user is a phone call away) But I wrote an app that due to the amount of data being queried it does occasionally timeout, I have increased the timout in the script but, the ugly error message pops up saying the script timed out from time to time.

How would I intercept this and display a page that simply states to the user "Your request took longer than anticipated, please click the 'Try Again' button to send your request again."
 
use javascript as your GUI for interaction with the user.
what you need to do is first determine the length of timeout to set.
eg:
session.timeout = 300

now write a javascript function for a timer.
first declare a var with the server timeout value
var timeoutVal = <%=session.timeout%> etc...

then you just set a timer in javascript.
something along the lines of
window.setTimeout(&quot;timeoutCheck()&quot;,timeoutVal);

on the timer running out alert the user or whatever means you want to use.

this action (event) will also cause the user to reacte to the page thus reloading it and setting the timeout over.

hope that helps

_________________________________________________________
$str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
$Nstr = ereg_replace(&quot;sleep&quot;,&quot;coffee&quot;,$str); echo $Nstr;

onpnt2.gif
[/sub]
 
You can also use standard ASP error-trapping, like:

Code:
On Error Goto ErrorHandler
Call Query_subroutine
On Error Goto 0

(On Error Goto 0 disables the errorhandling (=back to normal)).

Then, in you error-handling code, you can check for the error number for that specific error:
Code:
:ErrorHandler
If err.Number = XXX Then Handle_TimeOut_Sub

Palooka
 
Cool thanks I think I'll use the ASP rather than client side, anyone know the error code for timeout, figures now that I want the error I can't get one.

Thank you both for your time.
 
Can I use On Error FunctionName ? instead of On Error goto ErrorHandler?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top