Link to home
Start Free TrialLog in
Avatar of niidmore
niidmoreFlag for United Kingdom of Great Britain and Northern Ireland

asked on

handle exceptions

Hello there,
I know it is quite simple but I am still unable to make it work.

I want to catch exception in the scriptaculous script I have,

the script calls another functions

createNode('node1');
createNode('node2');
createNode('node3');

if there is no node2 object exist, it should simply ignore the call and not say -- node3 object not found
please advice.
regards
sam
ASKER CERTIFIED SOLUTION
Avatar of ChetOS82
ChetOS82
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of niidmore

ASKER

thanks chet, that worked for me. Yes, node2 is an ID of a HTML element in the example above.

http://xxx.xxx.xxx.26/vanillasite/carlton.asp

If you please follow the url above, the actual script works only in IE but not in Firefox. Can you please see if there is something wrong?
thanks for looking.
cheers
sam
Modify the catch block to display the error.  It looks like the last childnode in your createEffect function is throwing the error, which causes the execution to flow the to catch block.  This skips your other two createEffect calls.

try {
...
} catch(ex) {
     alert(ex);
}
yes you are right ! could you also please let me know the fix.
much appreciate for your help.
regards
sam
No, I am not sure what the problem is exactly.  I suggest that you download Firebug for Firefox and step through the code checking it with the debugger.
ok thanks for your help though