Browse Source

throw real Error instances (#2160)

codeClimate
wimrijnders 8 years ago
committed by Alexander Wunschik
parent
commit
85222bfd64
3 changed files with 8 additions and 8 deletions
  1. +2
    -2
      lib/graph3d/Filter.js
  2. +4
    -4
      lib/graph3d/Graph3d.js
  3. +2
    -2
      lib/graph3d/Slider.js

+ 2
- 2
lib/graph3d/Filter.js View File

@ -111,7 +111,7 @@ Filter.prototype.getValues = function() {
*/
Filter.prototype.getValue = function(index) {
if (index >= this.values.length)
throw 'Error: index out of range';
throw new Error('Index out of range');
return this.values[index];
};
@ -164,7 +164,7 @@ Filter.prototype.setOnLoadCallback = function(callback) {
*/
Filter.prototype.selectValue = function(index) {
if (index >= this.values.length)
throw 'Error: index out of range';
throw new Error('Index out of range');
this.index = index;
this.value = this.values[index];

+ 4
- 4
lib/graph3d/Graph3d.js View File

@ -249,7 +249,7 @@ Graph3d.prototype._setBackgroundColor = function(backgroundColor) {
// use use defaults
}
else {
throw 'Unsupported type of backgroundColor';
throw new Error('Unsupported type of backgroundColor');
}
this.frame.style.backgroundColor = fill;
@ -333,7 +333,7 @@ Graph3d.prototype._determineColumnIndexes = function(data, style) {
}
}
else {
throw 'Unknown style "' + this.style + '"';
throw new Error('Unknown style "' + this.style + '"');
}
};
@ -702,7 +702,7 @@ Graph3d.prototype._resizeCanvas = function() {
*/
Graph3d.prototype.animationStart = function() {
if (!this.frame.filter || !this.frame.filter.slider)
throw 'No animation available';
throw new Error('No animation available');
this.frame.filter.slider.play();
};
@ -937,7 +937,7 @@ Graph3d.prototype.setOptions = function (options) {
*/
Graph3d.prototype.redraw = function() {
if (this.dataPoints === undefined) {
throw 'Error: graph data not initialized';
throw new Error('Graph data not initialized');
}
this._resizeCanvas();

+ 2
- 2
lib/graph3d/Slider.js View File

@ -11,7 +11,7 @@ var util = require('../util');
*/
function Slider(container, options) {
if (container === undefined) {
throw 'Error: No container element defined';
throw new Error('No container element defined');
}
this.container = container;
this.visible = (options && options.visible != undefined) ? options.visible : true;
@ -253,7 +253,7 @@ Slider.prototype.setIndex = function(index) {
this.onChange();
}
else {
throw 'Error: index out of range';
throw new Error('Index out of range');
}
};

Loading…
Cancel
Save