"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 _errors_1 = require("../_errors");
var ErrorMatchError = (function (_super) {
__extends(ErrorMatchError, _super);
function ErrorMatchError(actualError, shouldMatch, expectedErrorType, expectedErrorMessage) {
_super.call(this, actualError, expectedErrorMessage, "");
if (expectedErrorType || expectedErrorMessage) {
if (expectedErrorType === undefined || expectedErrorType === null || (expectedErrorMessage && actualError instanceof expectedErrorType && expectedErrorMessage !== actualError.message)) {
this._message = "Expected an error with message \"" + expectedErrorMessage + "\" to " + (!shouldMatch ? "not " : "") + "have been thrown, but it was" + (!shouldMatch ? "" : "n't") + ".";
}
else if (expectedErrorMessage === undefined || (actualError && !(actualError instanceof expectedErrorType) && expectedErrorMessage === actualError.message)) {
this._message = "Expected an error of type " + expectedErrorType["name"] + " to " + (!shouldMatch ? "not " : "") + "have been thrown, but " + (shouldMatch ? actualError["name"] + " was thrown instead" : "it was") + ".";
}
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") + ".";
}
}
else {
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.";
}
}
}
return ErrorMatchError;
}(_errors_1.MatchError));
exports.ErrorMatchError = ErrorMatchError;
//# sourceMappingURL=error-match-error.js.map |