aboutsummaryrefslogtreecommitdiff
path: root/node_modules/schema-utils/src/ValidationError.js
blob: 21264b5cc6037947b0ce7585ba6a42c42881f521 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* eslint-disable
  strict
*/

'use strict';

class ValidationError extends Error {
  constructor(errors, name) {
    super();

    this.name = 'ValidationError';

    this.message = `${name || ''} Invalid Options\n\n`;

    errors.forEach((err) => {
      this.message += `options${err.dataPath} ${err.message}\n`;
    });

    this.errors = errors;

    Error.captureStackTrace(this, this.constructor);
  }
}

module.exports = ValidationError;