mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 06:00:56 -05:00
Clean up throw statements.
Never throw plain strings.
This commit is contained in:
parent
b9ba2364fe
commit
a3d0e0d462
2 changed files with 3 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue