Use a nicer URL for the error descriptions

This commit is contained in:
Andreas Hocevar
2016-08-03 09:38:15 +02:00
parent 6f5ed17fc5
commit 55ab5704d4
4 changed files with 4 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
#### Changes in the way assertions are handled #### Changes in the way assertions are handled
Previously, minified builds of the library did not have any assertions. This caused applications to fail silently or with cryptic stack traces. Starting with this release, developers get notified of many runtime errors through the new `ol.AssertionError`. This error has a `code` property. The meaning of the code can be found on http://openlayers.org/en/latest/doc/errors.html. There are additional console assertion checks when in debug mode when the new `ol.DEBUG` compiler flag (previously `goog.DEBUG`) is `true`. As this is `true` by default, it is recommended that those creating custom builds set this to `false` so these assertions are stripped.' Previously, minified builds of the library did not have any assertions. This caused applications to fail silently or with cryptic stack traces. Starting with this release, developers get notified of many runtime errors through the new `ol.AssertionError`. This error has a `code` property. The meaning of the code can be found on http://openlayers.org/en/latest/doc/errors/. There are additional console assertion checks when in debug mode when the new `ol.DEBUG` compiler flag (previously `goog.DEBUG`) is `true`. As this is `true` by default, it is recommended that those creating custom builds set this to `false` so these assertions are stripped.'
#### Removal of `ol.ENABLE_NAMED_COLORS` #### Removal of `ol.ENABLE_NAMED_COLORS`

View File

@@ -329,7 +329,7 @@ ol.AssertionError = function(code) {
*/ */
this.message = 'Assertion failed. See ' + this.message = 'Assertion failed. See ' +
(ol.VERSION ? 'http://openlayers.org/en/' + ol.VERSION.split('-')[0] : '') + (ol.VERSION ? 'http://openlayers.org/en/' + ol.VERSION.split('-')[0] : '') +
'/doc/errors.html#' + code + ' for details.'; '/doc/errors/#' + code + ' for details.';
/** /**
* Error code. The meaning of the code can be found on * Error code. The meaning of the code can be found on

View File

@@ -13,13 +13,13 @@ describe('ol', function() {
describe('ol.AssertionError', function() { describe('ol.AssertionError', function() {
it('generates a message', function() { it('generates a message', function() {
var error = new ol.AssertionError(42); var error = new ol.AssertionError(42);
expect(error.message).to.be('Assertion failed. See /doc/errors.html#42 for details.'); expect(error.message).to.be('Assertion failed. See /doc/errors/#42 for details.');
}); });
it('generates a message with a versioned url', function() { it('generates a message with a versioned url', function() {
var origVersion = ol.VERSION; var origVersion = ol.VERSION;
ol.VERSION = 'foo'; ol.VERSION = 'foo';
var error = new ol.AssertionError(42); var error = new ol.AssertionError(42);
expect(error.message).to.be('Assertion failed. See http://openlayers.org/en/foo/doc/errors.html#42 for details.'); expect(error.message).to.be('Assertion failed. See http://openlayers.org/en/foo/doc/errors/#42 for details.');
ol.VERSION = origVersion; ol.VERSION = origVersion;
}); });
it('has an error code', function() { it('has an error code', function() {