Make more verbose error message, and skip getting state of layer if it is instanceof Openlayers.Layer.Vector since it has no source.