Forum Moderators: open

Message Too Old, No Replies

Try - Catch in Javascript?

Is is possible?

         

Herath

9:53 pm on Sep 17, 2004 (gmt 0)

10+ Year Member



Is there any way you could catch a runtime error in javascript (without using IFs of course)

Rambo Tribble

10:26 pm on Sep 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try/catch/finally was implemented in JavaScript 1.4.

Gorilla

10:29 pm on Sep 17, 2004 (gmt 0)

10+ Year Member




Try the code below, and you should get a feeling for how to use try/catch to handle error conditions.

try {

i = 1 / 0;

}

catch ( e ) {

alert ( e );

}

Herath

1:42 pm on Sep 20, 2004 (gmt 0)

10+ Year Member



Great!. What browsers support Javascript 1.4?