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

Trapping errors in JavaScript or Calling CGIs

Status
Not open for further replies.

TWTD

Programmer
Apr 7, 2001
4
GB
Hi, first time posting so please be gentle!

I am running some scripts which exist on another server, and they may or may not exist at run-time. (A CGI will create the script later)

If it does not exist, IE ignores the error and continues processing, but Netscape does not. How can I make this happen?

The way I see it, I either need to trap the error, or call a cgi that creates a dummy JS file prior to the JS actually being called.

I am a complete novice at JavaScript, so I'd appreciate any advice.

Cheers

Gavin
 
do you ask for debug purpose or for error handling ??
to debug, use the javascript console with netscape, it's well done
to handle errors, it depends on which errors ...
 
Error handling unfortunately. If a script falls over, I would like to trap it.
 
then i'm afraid i can't help : i've never seen any error handling function in js - altough there must be some ??? i'm afraid that the errors are to be handled by the client's browser :-(
 
try try/catch blocks:

try
{
//some code
}
catch(e)
{
//something went wrong in try, so we will grab the error here
} jared@eae.net -
 
thank youuuuuuuuuoooo jaredn !!!!! i haven't noticed you could do this in javascript !
TWTD you're saved now :]]
 
Excellent!

Don't tell me, it only works in IE6? :)
 
Excellent!

Don't tell me, it only works in IE6? :)

Many thanks.

Gav
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top