Skip to content

Commit

Permalink
test for window.console and use console.warn instead of console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
emoen committed Feb 15, 2016
1 parent 1ea4ad1 commit 90ce03f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/script/widgets/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,13 +724,15 @@ gxp.Viewer = Ext.extend(Ext.util.Observable, {
var sources = {};
this.mapPanel.layers.each(function(record){
var layer = record.getLayer();
if (layer.displayInLayerSwitcher ) {
if ( layer.displayInLayerSwitcher ) {
var id = record.get("source");
var source = this.layerSources[id];
if (!source) {
// Either the layer has no source (id=null) or this layer has a layerSources which isnt defined
console.log("Could not find source type (e.g gxp_wmssource) for layer '" + layer.name + "' and layer id '" + layer.id + "'.");
console.log("Please provide a plugin source if the layer should be included in getState()");
// Provide a plugin source if the layer should be included in getState()
if (window.console) {
console.warn("Could not find source type (e.g gxp_wmssource) for layer '" + layer.name + "' and layer id '" + layer.id + "'.");
}
} else {
// add layer
state.map.layers.push(source.getConfigForRecord(record));
Expand Down

0 comments on commit 90ce03f

Please sign in to comment.