JAVASCRIPT   84

assertionerror.js

Guest on 22nd July 2021 12:08:48 PM

  1. goog.provide('ol.AssertionError');
  2.  
  3. goog.require('ol');
  4.  
  5. /**
  6.  * Error object thrown when an assertion failed. This is an ECMA-262 Error,
  7.  * extended with a `code` property.
  8.  * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error}
  9.  * @constructor
  10.  * @extends {Error}
  11.  * @implements {oli.AssertionError}
  12.  * @param {number} code Error code.
  13.  */
  14. ol.AssertionError = function(code) {
  15.  
  16.   var path = ol.VERSION ? ol.VERSION.split('-')[0] : 'latest';
  17.  
  18.   /**
  19.    * @type {string}
  20.    */
  21.   this.message = 'Assertion failed. See https://openlayers.org/en/' + path +
  22.       '/doc/errors/#' + code + ' for details.';
  23.  
  24.   /**
  25.    * Error code. The meaning of the code can be found on
  26.    * {@link https://openlayers.org/en/latest/doc/errors/} (replace `latest` with
  27.    * the version found in the OpenLayers script's header comment if a version
  28.    * other than the latest is used).
  29.    * @type {number}
  30.    * @api
  31.    */
  32.   this.code = code;
  33.  
  34.   this.name = 'AssertionError';
  35.  
  36. };
  37. ol.inherits(ol.AssertionError, Error);

Raw Paste


Login or Register to edit or fork this paste. It's free.