toBeRejectedWithError can expect the error to be Error, not just a subtype
This commit is contained in:
@@ -76,7 +76,7 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
|
||||
function getExpectedFromArgs(arg1, arg2) {
|
||||
var error, message;
|
||||
|
||||
if (typeof arg1 === 'function' && j$.isError_(arg1.prototype)) {
|
||||
if (isErrorConstructor(arg1)) {
|
||||
error = arg1;
|
||||
message = arg2;
|
||||
} else {
|
||||
@@ -90,4 +90,8 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
|
||||
printValue: j$.fnNameFor(error) + (typeof message === 'undefined' ? '' : ': ' + j$.pp(message))
|
||||
};
|
||||
}
|
||||
|
||||
function isErrorConstructor(value) {
|
||||
return typeof value === 'function' && (value === Error || j$.isError_(value.prototype));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user