diff --git a/spec/core/matchers/toThrowErrorSpec.js b/spec/core/matchers/toThrowErrorSpec.js index 1c0faee1..43b3b8ed 100644 --- a/spec/core/matchers/toThrowErrorSpec.js +++ b/spec/core/matchers/toThrowErrorSpec.js @@ -170,7 +170,6 @@ describe("toThrowError", function() { result; CustomError.prototype = new Error(); - CustomError.prototype.constructor = CustomError; result = matcher.compare(fn, CustomError); @@ -222,7 +221,6 @@ describe("toThrowError", function() { result; CustomError.prototype = new Error(); - CustomError.prototype.constructor = CustomError; result = matcher.compare(fn, CustomError, "foo"); diff --git a/src/core/matchers/toThrowError.js b/src/core/matchers/toThrowError.js index 5fbe1b2c..41ab793d 100644 --- a/src/core/matchers/toThrowError.js +++ b/src/core/matchers/toThrowError.js @@ -109,7 +109,7 @@ getJasmineRequireObj().toThrowError = function(j$) { return expected === null && errorType === null; }, matches: function(error) { - return (errorType === null || error.constructor === errorType) && + return (errorType === null || error instanceof errorType) && (expected === null || messageMatch(error.message)); } };