diff --git a/lodash.js b/lodash.js index 8c00fa428..854d9edae 100644 --- a/lodash.js +++ b/lodash.js @@ -9871,9 +9871,8 @@ if (!isObjectLike(value)) { return false; } - var Ctor = value.constructor; return (objectToString.call(value) == errorTag) || - (typeof Ctor == 'function' && objectToString.call(Ctor.prototype) == errorTag); + (typeof value.message == 'string' && typeof value.name == 'string'); } /** diff --git a/test/test.js b/test/test.js index 3f7673d85..f98481ca9 100644 --- a/test/test.js +++ b/test/test.js @@ -364,7 +364,9 @@ this.message = message; } - CustomError.prototype = lodashStable.create(Error.prototype); + CustomError.prototype = lodashStable.create(Error.prototype, { + 'constructor': CustomError + }); /** * Removes all own enumerable properties from a given object.