# all files / ol/ assertionerror.js

100% Statements 8/8
50% Branches 1/2
100% Functions 1/1
100% Lines 8/8

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    381×

    1×

    1×

    40×

    40×

    40×

    40×

    1×
     goog.provide('ol.AssertionError');

    goog.require('ol');

    /**
     * Error object thrown when an assertion failed. This is an ECMA-262 Error,
     * extended with a `code` property.
     * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error}
     * @constructor
     * @extends {Error}
     * @implements {oli.AssertionError}
     * @param {number} code Error code.
     */
    ol.AssertionError = function(code) {

      var path = ol.VERSION ? ol.VERSION.split('-')[0] : 'latest';

      /**
       * @type {string}
       */
      this.message = 'Assertion failed. See https://openlayers.org/en/' + path +
          '/doc/errors/#' + code + ' for details.';

      /**
       * Error code. The meaning of the code can be found on
       * {@link https://openlayers.org/en/latest/doc/errors/} (replace `latest` with
       * the version found in the OpenLayers script's header comment if a version
       * other than the latest is used).
       * @type {number}
       * @api
       */
      this.code = code;

      this.name = 'AssertionError';

    };
    ol.inherits(ol.AssertionError, Error);