From b1d2d1ddae3af7372c3790842506b65c3bc398c3 Mon Sep 17 00:00:00 2001 From: David da Silva Date: Tue, 25 Aug 2015 17:49:02 +0200 Subject: [PATCH] Throw error when subclass name is not a string --- subclass-error.js | 1 + 1 file changed, 1 insertion(+) diff --git a/subclass-error.js b/subclass-error.js index 9d3671b..2b384c8 100644 --- a/subclass-error.js +++ b/subclass-error.js @@ -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