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