[OpenLayers-Users] customizing on error behaviour

Christopher Schmidt crschmidt at metacarta.com
Fri Apr 17 07:40:43 EDT 2009


On Fri, Apr 17, 2009 at 11:37:12AM +0200, Marco Ferretti wrote:
> Hi all, 
> 
> I need to customize my application in order to be able to
> react to a communication error with the WMS server. 
> 
> I have been surfing around the OpenLayers code but could not
> understand which ( if any ) entry point I have available in
> order to catch when OpenLayers recognizes a com. error with
> the server . 
> 
> Let me be a little clearer : when OpenLayers sends the pink
> tile it recognizes that there is an error; what I would
> like, here, is a way to get a callback to my code by
> "extending" an OpenLayers default function. I saw that in
> Util.js the function OpenLayers.Util.onImageLoadError does
> the do the trick by setting the background color. Is there a
> way to get notified somehow that the function has set the
> background as a consequence of detecting an error loading
> the tile ?

You can override OpenLayers.Util.onImageLoadError:

  OpenLayers.Util.onImageLoadError = function() {
    alert(this.src + ' is broken!');
  }

This is a brute force technique, but we don't have anything btter atm, 
afaik.


> Obviously I can modify the Util.js lib ... but I would like
> to create a wrapper so that I will be "update" safe ( unless
> you do some major rework on that function ) ; can you please
> point me somewhere ?

The above should be safe; we support it, insofar as we have encouraged
many people to use it and I would mention it in release notes if it
needed to change for some reason, but it never has so I consider that
unlikely in any case.


> TIA
> 
> Marco
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list