-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from Avocarrot/feat/fieldValidations
feat(custom-validation) Adds code to apply custom validations on any …
- Loading branch information
Showing
8 changed files
with
154 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
module.exports = { | ||
NotFoundError: require('./NotFoundError'), | ||
ValidationError: require('./ValidationError'), | ||
TypeValidationError: require('./TypeValidationError'), | ||
CustomValidationError: require('./CustomValidationError'), | ||
AlreadyExistsError: require('./AlreadyExistsError') | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters