diff --git a/lib/errors/CustomValidationError.js b/lib/errors/CustomValidationError.js new file mode 100644 index 0000000..64e9a00 --- /dev/null +++ b/lib/errors/CustomValidationError.js @@ -0,0 +1,12 @@ +var util = require('util'); + +var CustomValidationError = function (message, property) { + Error.captureStackTrace(this, this); + this.message = message; + this.property = property; +}; + +util.inherits(CustomValidationError, Error); +CustomValidationError.prototype.name = 'CustomValidationError'; + +module.exports = CustomValidationError; \ No newline at end of file diff --git a/lib/errors/TypeValidationError.js b/lib/errors/TypeValidationError.js new file mode 100644 index 0000000..58350b9 --- /dev/null +++ b/lib/errors/TypeValidationError.js @@ -0,0 +1,13 @@ +var util = require('util'); + +var TypeValidationError = function (message, property, correctType) { + Error.captureStackTrace(this, this); + this.message = message; + this.property = property; + this.correctType = correctType; +}; + +util.inherits(TypeValidationError, Error); +TypeValidationError.prototype.name = 'TypeValidationError'; + +module.exports = TypeValidationError; \ No newline at end of file