JAVASCRIPT 24
ValidationError.js Guest on 4th May 2021 08:02:23 AM
  1. /* eslint-disable
  2.   strict
  3. */
  4.  
  5. 'use strict';
  6.  
  7. class ValidationError extends Error {
  8.   constructor(errors, name) {
  9.     super();
  10.  
  11.     this.name = 'ValidationError';
  12.  
  13.     this.message = `${name || ''} Invalid Options\n\n`;
  14.  
  15.     errors.forEach((err) => {
  16.       this.message += `options${err.dataPath} ${err.message}\n`;
  17.     });
  18.  
  19.     this.errors = errors;
  20.  
  21.     Error.captureStackTrace(this, this.constructor);
  22.   }
  23. }
  24.  
  25. module.exports = ValidationError;

Paste-bin is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.