validation.js 380 B

12345678910111213141516171819
  1. module.exports = ValidationError
  2. function ValidationError(errors) {
  3. var result = new Error()
  4. Object.defineProperty(result, "type", {
  5. value: result.type,
  6. enumerable: true,
  7. writable: true,
  8. configurable: true
  9. })
  10. result.errors = errors
  11. result.message = errors[0].message
  12. result.type = "ValidationError"
  13. return result
  14. }