planetfederal / gxp

High level components for GeoExt based applications.
http://boundlessgeo.com/
Other
84 stars 97 forks source link

Viewer.getState - add more info in error when no source #185

Open emoen opened 11 years ago

emoen commented 11 years ago

In Viewer.js - getState - ... if (!source) { throw new Error("Could not find source for layer '" + record.get("name") + "'"); }

should be more verbose if eg. layer is a OpenLayers.Layer.Vector. Replace with something like: throw new Error("Could not find source for record '" + record.get("name") + " and layer" + layer.name + "'");

emoen commented 11 years ago

Also OpenLayers.Layer.Vector has no source so can be skipped - by replacing if (layer.displayInLayerSwitcher ) { with if (layer.displayInLayerSwitcher && !(layer instanceof OpenLayers.Layer.Vector) ) {

ahocevar commented 11 years ago

Thanks for the bug report @emoen. Would you be able to provide a pull request?