"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) Eif (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var match_error_1 = require("./match-error");
var ErrorMatchError = (function (_super) {
__extends(ErrorMatchError, _super);
function ErrorMatchError(actualError, shouldMatch, expectedErrorType, expectedErrorMessage) {
_super.call(this, actualError, expectedErrorMessage, "");
if (!actualError === shouldMatch) {
if (shouldMatch) {
this._message = "Expected an error to be thrown but no errors were thown.";
}
else {
this._message = "Expected an error not to be thrown but an error was thown.";
}
}
else if (actualError instanceof expectedErrorType !== shouldMatch) {
this._message = "Expected an error of type " + expectedErrorType["name"] + " to " + (!shouldMatch ? "not " : "") + "have been thrown, but it was" + (!shouldMatch ? "" : "n't") + ".";
}
else if (actualError.message === expectedErrorMessage !== shouldMatch) {
this._message = "Expected an error with message \"" + expectedErrorMessage + "\" to " + (!shouldMatch ? "not " : "") + "have been thrown, but it was" + (!shouldMatch ? "" : "n't") + ".";
}
else {
this._message = "Expected an error with message \"" + expectedErrorMessage + "\" and type " + expectedErrorType["name"] + " to " + (!shouldMatch ? "not " : "") + "have been thrown, but it was" + (!shouldMatch ? "" : "n't") + ".";
}
}
return ErrorMatchError;
}(match_error_1.MatchError));
exports.ErrorMatchError = ErrorMatchError;
//# sourceMappingURL=error-match-error.js.map |