diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-05-23 17:17:22 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-05-23 17:17:22 +0200 |
| commit | 49e6a1aca0a3b3349c57739ad67ea0756e3627f5 (patch) | |
| tree | 52c43b6f8d8a0affc5c5c43c35f861c42a400128 | |
| parent | 8034e21467dac5dfdacb94fde2f6aa5010b1b266 (diff) | |
| parent | dc93dcb8addd6e0deb0b984e2682fcfac1f27716 (diff) | |
| download | mullvadvpn-49e6a1aca0a3b3349c57739ad67ea0756e3627f5.tar.xz mullvadvpn-49e6a1aca0a3b3349c57739ad67ea0756e3627f5.zip | |
Merge branch 'asserts'
| -rw-r--r-- | app/components/Connect.js | 4 | ||||
| -rw-r--r-- | app/lib/formatters.js | 2 | ||||
| -rw-r--r-- | app/lib/keyframe-animation.js | 8 | ||||
| -rw-r--r-- | app/lib/tray-icon-manager.js | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/app/components/Connect.js b/app/components/Connect.js index d759c994fd..1859fe485e 100644 --- a/app/components/Connect.js +++ b/app/components/Connect.js @@ -398,12 +398,12 @@ export default class Connect extends Component { } toLngLat(pos) { - assert(pos.length === 2); + assert(pos.length === 2, 'wrong number of coordinates in position'); return [ pos[1], pos[0] ]; } toLngLatBounds(bounds) { - assert(bounds.length % 2 === 0); + assert(bounds.length % 2 === 0, 'wrong number of sides in bounds'); let result = []; for(let i = 0; i < bounds.length; i += 2) { result.push(bounds.slice(i, i + 2).reverse()); diff --git a/app/lib/formatters.js b/app/lib/formatters.js index 6071d87fd5..7fd355efde 100644 --- a/app/lib/formatters.js +++ b/app/lib/formatters.js @@ -5,7 +5,7 @@ import assert from 'assert'; * @param {string} val account number */ export const formatAccount = (val) => { - assert(typeof(val) === 'string'); + assert(typeof(val) === 'string', 'account number must be a string'); // display number altogether when longer than 12 if(val.length > 12) { diff --git a/app/lib/keyframe-animation.js b/app/lib/keyframe-animation.js index 6f253b9bfd..c765cf5a93 100644 --- a/app/lib/keyframe-animation.js +++ b/app/lib/keyframe-animation.js @@ -147,7 +147,7 @@ export default class KeyframeAnimation { * @return {KeyframeAnimation} */ static fromFileSequence(filePattern, range) { - assert(range.length === 2 && range[0] < range[1]); + assert(range.length === 2 && range[0] < range[1], 'the animation range is invalid'); let images = []; for(let i = range[0]; i <= range[1]; i++) { @@ -164,7 +164,7 @@ export default class KeyframeAnimation { * @memberOf KeyframeAnimation */ constructor(images) { - assert(images.length > 0); + assert(images.length > 0, 'too few images in animation'); this._source = images.slice(); this._nativeImages = images.map((pathOrNativeImage) => { @@ -213,8 +213,8 @@ export default class KeyframeAnimation { let { startFrame, endFrame, beginFromCurrentState, advanceTo } = options; if(startFrame !== undefined && endFrame !== undefined) { - assert(startFrame >= 0 && startFrame < this._numFrames); - assert(endFrame >= 0 && endFrame < this._numFrames); + assert(startFrame >= 0 && startFrame < this._numFrames, 'start frame is invalid'); + assert(endFrame >= 0 && endFrame < this._numFrames, 'end frame is invalid'); if(startFrame < endFrame) { this._frameRange = [ startFrame, endFrame ]; diff --git a/app/lib/tray-icon-manager.js b/app/lib/tray-icon-manager.js index 1b0bab3836..8898f7bc48 100644 --- a/app/lib/tray-icon-manager.js +++ b/app/lib/tray-icon-manager.js @@ -83,4 +83,4 @@ export default class TrayIconManager { this._iconType = type; } -}
\ No newline at end of file +} |
