Skip to content

Commit

Permalink
Throw error when subclass name is not a string
Browse files Browse the repository at this point in the history
  • Loading branch information
dasilvacontin committed Aug 27, 2015
1 parent d96d9c2 commit b1d2d1d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions subclass-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
var ErrorInheritor = function () {}
function SubclassError (name, BaseError, props) {
if (name === undefined) throw new Error('Name of subclass must be provided as first argument.')
if (typeof name !== 'string') throw new Error('Expected first argument to be a string in SubclassError(name, [BaseError, [props]])')
if (!(BaseError instanceof Function)) {
props = BaseError
BaseError = Error
Expand Down

0 comments on commit b1d2d1d

Please sign in to comment.