UNPKG

443 BJavaScriptView Raw
1exports.error = function(options) {
2 return new Error(options);
3};
4
5var Error = function(options) {
6 this._expected = options.expected;
7 this._actual = options.actual;
8 this._location = options.location;
9};
10
11Error.prototype.describe = function() {
12 var locationDescription = this._location ? this._location.describe() + ":\n" : "";
13 return locationDescription + "Expected " + this._expected + "\nbut got " + this._actual;
14};