UNPKG

react-router-ga

Version:

[![Downloads](https://img.shields.io/npm/dm/react-router-ga)](https://npm.im/react-router-ga) [![Version](https://img.shields.io/npm/v/react-router-ga)](https://npm.im/react-router-ga) [![License](https://img.shields.io/npm/l/react-router-ga)](https://ope

31 lines (21 loc) 568 B
/* eslint-disable strict, no-param-reassign */ 'use strict'; class ValidationError extends Error { constructor(errors, name) { super(); this.name = 'ValidationError'; this.message = `${name || ''} Invalid Options\n\n`; this.errors = errors.map((err) => { err.dataPath = err.dataPath.replace(/\//g, '.'); return err; }); this.errors.forEach((err) => { this.message += `options${err.dataPath} ${err.message}\n`; }); Error.captureStackTrace(this, this.constructor); } } module.exports = ValidationError;