Skip to content

Commit

Permalink
Use a nicer URL for the error descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Aug 4, 2016
1 parent 6f5ed17 commit 55ab570
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion changelog/upgrade-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### 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`

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/ol/ol.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ ol.AssertionError = function(code) {
*/
this.message = 'Assertion failed. See ' +
(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
Expand Down
4 changes: 2 additions & 2 deletions test/spec/ol/ol.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ describe('ol', function() {
describe('ol.AssertionError', function() {
it('generates a message', function() {
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() {
var origVersion = ol.VERSION;
ol.VERSION = 'foo';
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;
});
it('has an error code', function() {
Expand Down

0 comments on commit 55ab570

Please sign in to comment.