@build-tracker/api-errors
Advanced tools
Comparing version 1.0.0-beta.0 to 1.0.0-beta.9
@@ -52,2 +52,13 @@ "use strict"; | ||
exports.UnimplementedError = UnimplementedError; | ||
var ValidationError = /** @class */ (function (_super) { | ||
__extends(ValidationError, _super); | ||
function ValidationError(field, expected, received) { | ||
var _this = _super.call(this, "\"" + field + "\" expected to receive \"" + expected + "\", but value was \"" + received + "\"") || this; | ||
_this.status = 400; | ||
Object.setPrototypeOf(_this, ValidationError.prototype); | ||
return _this; | ||
} | ||
return ValidationError; | ||
}(Error)); | ||
exports.ValidationError = ValidationError; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@build-tracker/api-errors", | ||
"version": "1.0.0-beta.0", | ||
"version": "1.0.0-beta.9", | ||
"description": "Build Tracker API errors", | ||
@@ -16,3 +16,3 @@ "author": "Paul Armstrong <paul@spaceyak.com>", | ||
}, | ||
"gitHead": "14874c7ee8411950ff8bbf557dcd3c2c71359f8e", | ||
"gitHead": "7864c340fb0cfa9efadf5c26b8dc44882eaea427", | ||
"publishConfig": { | ||
@@ -19,0 +19,0 @@ "access": "public" |
@@ -31,1 +31,10 @@ /** | ||
} | ||
export class ValidationError extends Error { | ||
public readonly status = 400; | ||
public constructor(field: string, expected: string, received: string | number | void) { | ||
super(`"${field}" expected to receive "${expected}", but value was "${received}"`); | ||
Object.setPrototypeOf(this, ValidationError.prototype); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
6971
121