Clean up throw statements.

Never throw plain strings.
This commit is contained in:
Jürg Lehni 2013-10-14 16:05:50 +02:00
parent b9ba2364fe
commit a3d0e0d462
2 changed files with 3 additions and 2 deletions

View file

@ -322,7 +322,8 @@ var Item = Base.extend(Callback, /** @lends Item# */{
// See if the name is a simple number, which we cannot support due to
// the named lookup on the children array.
if (name === (+name) + '')
throw 'Names consisting only of numbers are not supported.'
throw new Error(
'Names consisting only of numbers are not supported.');
if (name && this._parent) {
var children = this._parent._children,
namedChildren = this._parent._namedChildren,

View file

@ -2234,7 +2234,7 @@ var Path = PathItem.extend(/** @lends Path# */{
// Otherwise we bail out:
if (!throughSide)
return this.lineTo(to);
throw new Error("Cannot put an arc through the given points: "
throw new Error('Cannot put an arc through the given points: '
+ [from, through, to]);
}
var vector = from.subtract(center),