From 3f3e412d10f367da41f11ab01c597beda04ca880 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Sat, 16 Dec 2017 08:25:23 +0100 Subject: [PATCH] Rename _ol_AssertionError_ to AssertionError --- src/ol/AssertionError.js | 6 +++--- src/ol/Collection.js | 4 ++-- src/ol/asserts.js | 4 ++-- test/spec/ol/assertionerror.test.js | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ol/AssertionError.js b/src/ol/AssertionError.js index 95418f2112..6b1bcc4ac3 100644 --- a/src/ol/AssertionError.js +++ b/src/ol/AssertionError.js @@ -12,7 +12,7 @@ import {VERSION, inherits} from './index.js'; * @implements {oli.AssertionError} * @param {number} code Error code. */ -var _ol_AssertionError_ = function(code) { +var AssertionError = function(code) { var path = VERSION ? VERSION.split('-')[0] : 'latest'; @@ -36,6 +36,6 @@ var _ol_AssertionError_ = function(code) { }; -inherits(_ol_AssertionError_, Error); +inherits(AssertionError, Error); -export default _ol_AssertionError_; +export default AssertionError; diff --git a/src/ol/Collection.js b/src/ol/Collection.js index 35598754a0..71cb942b87 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -2,7 +2,7 @@ * @module ol/Collection */ import {inherits} from './index.js'; -import _ol_AssertionError_ from './AssertionError.js'; +import AssertionError from './AssertionError.js'; import _ol_CollectionEventType_ from './CollectionEventType.js'; import _ol_Object_ from './Object.js'; import Event from './events/Event.js'; @@ -268,7 +268,7 @@ _ol_Collection_.prototype.updateLength_ = function() { _ol_Collection_.prototype.assertUnique_ = function(elem, opt_except) { for (var i = 0, ii = this.array_.length; i < ii; ++i) { if (this.array_[i] === elem && i !== opt_except) { - throw new _ol_AssertionError_(58); + throw new AssertionError(58); } } }; diff --git a/src/ol/asserts.js b/src/ol/asserts.js index e284c80901..626f95d744 100644 --- a/src/ol/asserts.js +++ b/src/ol/asserts.js @@ -1,7 +1,7 @@ /** * @module ol/asserts */ -import _ol_AssertionError_ from './AssertionError.js'; +import AssertionError from './AssertionError.js'; var _ol_asserts_ = {}; @@ -11,7 +11,7 @@ var _ol_asserts_ = {}; */ _ol_asserts_.assert = function(assertion, errorCode) { if (!assertion) { - throw new _ol_AssertionError_(errorCode); + throw new AssertionError(errorCode); } }; export default _ol_asserts_; diff --git a/test/spec/ol/assertionerror.test.js b/test/spec/ol/assertionerror.test.js index 70a7d9c14b..03999ebe16 100644 --- a/test/spec/ol/assertionerror.test.js +++ b/test/spec/ol/assertionerror.test.js @@ -1,25 +1,25 @@ import {VERSION} from '../../../src/ol/index.js'; -import _ol_AssertionError_ from '../../../src/ol/AssertionError.js'; +import AssertionError from '../../../src/ol/AssertionError.js'; describe('ol.AssertionError', function() { it('generates an error', function() { - var error = new _ol_AssertionError_(42); + var error = new AssertionError(42); expect(error).to.be.an(Error); }); it('generates a message with a versioned url', function() { - var error = new _ol_AssertionError_(42); + var error = new AssertionError(42); var path = VERSION ? VERSION.split('-')[0] : 'latest'; expect(error.message).to.be('Assertion failed. See https://openlayers.org/en/' + path + '/doc/errors/#42 for details.'); }); it('has an error code', function() { - var error = new _ol_AssertionError_(42); + var error = new AssertionError(42); expect(error.code).to.be(42); }); it('has a name', function() { - var error = new _ol_AssertionError_(42); + var error = new AssertionError(42); expect(error.name).to.be('AssertionError'); }); });