AnsweredAssumed Answered

503 error (temporarily unavailable) does not throw a layer's onError event

Question asked by stevel on Jul 25, 2012
Latest reply on Aug 6, 2012 by geonetadmin
I'm trying to trap for the situation when an ArcGIS Server service isn't available because the server is down, so I'm trying to listen for the layer's onError event.

I'm finding that this isn't firing when the layer returns a ""NetworkError: 503 Service Temporarily Unavailable" error.

To illustrate, try this:

var layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_Worl/MapServer");
map.addLayer(layer);
dojo.connect(layer, "onError", function() {console.log("problem with layer");});


This will display the message, since that layer doesn't exist on that server (I removed the D from WORLD). Now try replacing that URL with a service which does exist but which isn't currently running (ie, if you tried to open its URL in a web browser you'd see a 503 error).

[ATTACH=CONFIG]16403[/ATTACH]

I get a 503 message displayed in the Firebug console, but the layer's onError event does not fire.

[ATTACH=CONFIG]16404[/ATTACH]

Thanks,
Steve

Outcomes