Use instanceof when checking Error types in toThrowError

Fixes #819
This commit is contained in:
Gregg Van Hove
2015-04-09 15:36:59 -07:00
parent 7cd8c41d31
commit ff029b37b5
2 changed files with 1 additions and 3 deletions

View File

@@ -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");

View File

@@ -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));
}
};