From 46a0589547c23d0701e449ee718961404eca8a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 3 Mar 2011 17:29:40 +0000 Subject: [PATCH] Use Error constructor correctly. --- src/basic/Matrix.js | 2 +- src/color/Gradient.js | 2 +- src/color/RGBColor.js | 3 ++- src/path/CompoundPath.js | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/basic/Matrix.js b/src/basic/Matrix.js index 42edb6d6..4ca14d59 100644 --- a/src/basic/Matrix.js +++ b/src/basic/Matrix.js @@ -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'); }, /** diff --git a/src/color/Gradient.js b/src/color/Gradient.js index 7adb0073..d3cc1619 100644 --- a/src/color/Gradient.js +++ b/src/color/Gradient.js @@ -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; } }); diff --git a/src/color/RGBColor.js b/src/color/RGBColor.js index 466ec4b5..70c6fac2 100644 --- a/src/color/RGBColor.js +++ b/src/color/RGBColor.js @@ -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); }; diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 7cc8138e..16edde23 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -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'); } }