How to use the global/window.console.error function in global

To help you get started, we’ve selected a few global examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keplergl / kepler.gl / src / layers / base-layer.js View on Github external
calculateLayerDomain(dataset, visualChannel) {
    const {allData, filteredIndexForDomain} = dataset;
    const defaultDomain = [0, 1];
    const {scale} = visualChannel;
    const scaleType = this.config[scale];

    const field = this.config[visualChannel.field];
    if (!field) {
      // if colorField or sizeField were set back to null
      return defaultDomain;
    }

    if (!SCALE_TYPES[scaleType]) {
      Console.error(`scale type ${scaleType} not supported`);
      return defaultDomain;
    }

    // TODO: refactor to add valueAccessor to field
    const fieldIdx = field.tableFieldIndex - 1;
    const isTime = field.type === ALL_FIELD_TYPES.timestamp;
    const valueAccessor = maybeToDate.bind(
      null,
      isTime,
      fieldIdx,
      field.format
    );
    const indexValueAccessor = i => valueAccessor(allData[i]);

    const sortFunction = getSortingFunction(field.type);
github keplergl / kepler.gl / src / components / injector.js View on Github external
const get = (fac, parent) => {
    const factory = map.get(fac);
    // factory is not injected
    if (!factory) {
      Console.error(errorMsg.noDep(fac, parent));
      return MissingComp;
    }

    // check if custom factory deps is declared
    const depsLength = factory.deps ? factory.deps.length : 0;
    let instances;
    if (factory.length !== depsLength) {
      Console.error(errorMsg.incompatibleDeps(factory, depsLength));

      const MissingDeps = () => (
        <div>{factory.name} is missing dependencies</div>
      );
      instances = MissingDeps;
    } else {
      instances =
        cache.get(factory) ||
        factory(
          ...(factory.deps ? factory.deps.map(dep =&gt; get(dep, factory)) : [])
        );
    }

    cache.set(fac, instances);
    return instances;
  };
github keplergl / kepler.gl / src / reducers / vis-state-updaters.js View on Github external
export function layerTypeChangeUpdater(state, action) {
  const {oldLayer, newType} = action;
  if (!oldLayer) {
    return state;
  }
  const oldId = oldLayer.id;
  const idx = state.layers.findIndex(l => l.id === oldId);

  if (!state.layerClasses[newType]) {
    Console.error(`${newType} is not a valid layer type`);
    return state;
  }

  // get a mint layer, with new id and type
  // because deck.gl uses id to match between new and old layer.
  // If type has changed but id is the same, it will break
  const newLayer = new state.layerClasses[newType]();

  newLayer.assignConfigToLayer(oldLayer.config, oldLayer.visConfigSettings);

  if (newLayer.config.dataId) {
    const dataset = state.datasets[newLayer.config.dataId];
    newLayer.updateLayerDomain(dataset);
  }

  const {layerData, layer} = calculateLayerData(newLayer, state);
github keplergl / kepler.gl / src / deckgl-layers / layer-utils / shader-utils.js View on Github external
export function editShader(vs, type, originalText, testToReplace) {

  if (!vs.includes(originalText)) {
    // Here we call Console.error when we fail to edit deck.gl shader
    // This should be caught by layer test
    Console.error(`Cannot edit ${type} layer shader`);
    return vs;
  }

  return vs.replace(originalText, testToReplace);
}
github keplergl / kepler.gl / src / schemas / schema-manager.js View on Github external
validateVersion(version) {
    if (!version) {
      Console.error(
        'There is no version number associated with this saved map'
      );
      return null;
    }

    if (!this._validVersions[version]) {
      Console.error(`${version} is not a valid version`);
      return null;
    }

    return version;
  }
github keplergl / kepler.gl / src / components / injector.js View on Github external
export function typeCheckRecipe(recipe) {
  if (!Array.isArray(recipe) || recipe.length &lt; 2) {
    Console.error(errorMsg.wrongPairType);
    return false;
  }

  const [factory, replacement] = recipe;
  if (typeof factory !== 'function') {
    Console.error('Error injecting factory: ', factory);
    Console.error(errorMsg.notFunc);
    return false;
  } else if (typeof replacement !== 'function') {
    Console.error('Error injecting replacement for: ', factory);
    Console.error(errorMsg.notFunc);
    return false;
  }

  return true;
}
github keplergl / kepler.gl / src / schemas / schema.js View on Github external
outdatedVersionError() {
    if (!this._isCurrentVersion()) {
      Console.error(
        `${this.key} ${
          this.version
        } is outdated. save should not be called anymore`
      );
    }
  }
github keplergl / kepler.gl / src / components / injector.js View on Github external
export function typeCheckRecipe(recipe) {
  if (!Array.isArray(recipe) || recipe.length &lt; 2) {
    Console.error(errorMsg.wrongPairType);
    return false;
  }

  const [factory, replacement] = recipe;
  if (typeof factory !== 'function') {
    Console.error('Error injecting factory: ', factory);
    Console.error(errorMsg.notFunc);
    return false;
  } else if (typeof replacement !== 'function') {
    Console.error('Error injecting replacement for: ', factory);
    Console.error(errorMsg.notFunc);
    return false;
  }

  return true;
}
github keplergl / kepler.gl / src / schemas / schema-manager.js View on Github external
validateVersion(version) {
    if (!version) {
      Console.error(
        'There is no version number associated with this saved map'
      );
      return null;
    }

    if (!this._validVersions[version]) {
      Console.error(`${version} is not a valid version`);
      return null;
    }

    return version;
  }