mapstraction/mxn — pull request #146 by jcushman (2012-06-04 21:11:56+00:00)
Title: Handle excessive use message in OpenLayers geocoder.

I foolishly started calling the OpenLayers geocoder too quickly and was temporarily blocked. This exposed an error in the mxn openlayers geocoder api. OpenLayers responds to excessive use with a 503 status and an HTML page explaining the problem. The mxn api was trying to parse the HTML as JSON and throwing an uncaught error. I changed it to detect the 503 prior to JSON decoding and try to provide a helpful error message.

Todo: It might make sense, instead of my generic message, to actually parse the HTML response and have a different message for excessive use than for other 503 situations. But this is a lot better than nothing.

There's also a bug request to switch to the mapquest API for openlayers, and I don't know if that would obviate this whole thing ...