bf5ac9d196af7afb9b652518922a9d5762a6ab940e980078b59c873b931f8e1e61c0a7e689a2e0cd219781700901587d0627d369986b5c5859625ccf0940a6 568 B

123456789101112131415161718192021222324252627282930
  1. /* eslint-disable
  2. strict,
  3. no-param-reassign
  4. */
  5. 'use strict';
  6. class ValidationError extends Error {
  7. constructor(errors, name) {
  8. super();
  9. this.name = 'ValidationError';
  10. this.message = `${name || ''} Invalid Options\n\n`;
  11. this.errors = errors.map((err) => {
  12. err.dataPath = err.dataPath.replace(/\//g, '.');
  13. return err;
  14. });
  15. this.errors.forEach((err) => {
  16. this.message += `options${err.dataPath} ${err.message}\n`;
  17. });
  18. Error.captureStackTrace(this, this.constructor);
  19. }
  20. }
  21. module.exports = ValidationError;