tjbnc

Catch a failure to load map when an exception isn't being thrown

Discussion created by tjbnc on Jun 15, 2010
Latest reply on Jun 29, 2010 by apfister-esristaff
I have code that looks something like this:

            map = new esri.Map("mapDiv");
            dojo.connect(map, "onLoad", DoSomething);
            map.addLayer(service);

If for some reason the service isn't being added, then the OnLoad event doesn't happen and DoSomething doesn't get called.

If the map fails to load, I would like to report back to the user so the user knows there is a problem and doesn't waif for DoSomething.

Is there a way to catch this and handle it gracefully - note that the addLayer method call is not throwing an exception.

Thank you in advance.

TJ

Outcomes