Use Error constructor correctly.

This commit is contained in:
Jürg Lehni 2011-03-03 17:29:40 +00:00
parent 484d74160b
commit 46a0589547
4 changed files with 5 additions and 4 deletions

View file

@ -54,7 +54,7 @@ var Matrix = Base.extend({
this._m10 = this._m01 = this._m02 = this._m12 = 0;
}
if (!ok)
throw Error('Unsupported matrix parameters');
throw new Error('Unsupported matrix parameters');
},
/**

View file

@ -10,7 +10,7 @@ var Gradient = Base.extend({
setStops: function(stops) {
if (stops.length < 2)
throw Error('Gradient stop list needs to contain at least two stops.');
throw new Error('Gradient stop list needs to contain at least two stops.');
this._stops = stops;
}
});

View file

@ -64,7 +64,8 @@ var RGBColor = Color.extend(new function() {
function namedToComponents(name) {
var hex = namedColors[name];
if (!hex) throw Error('The named color "' + name + '" does not exist.');
if (!hex)
throw new Error('The named color "' + name + '" does not exist.');
return hex && hexToComponents(hex);
};

View file

@ -81,7 +81,7 @@ var CompoundPath = PathItem.extend({
if (that.children.length) {
return that.children[that.children.length - 1];
} else {
throw Error('Use a moveTo() command first');
throw new Error('Use a moveTo() command first');
}
}