UNPKG

resumefy

Version:

A simple toolkit to bring your JSON Resume to life

12 lines (11 loc) 472 B
import { yellow } from 'ansicolor'; export class ValidationError extends Error { errors; constructor(errors) { const errorsWord = errors.length === 1 ? 'error' : 'errors'; const messageTitle = `Validation of resume JSON file failed with ${yellow(`${errors.length} ${errorsWord}`)}`; const errorList = errors.map((e) => ` - ${e.toString()}`).join('\n'); super(`${messageTitle}:\n${errorList}`); this.errors = errors; } }