import { GraphQLError } from 'graphql/error/GraphQLError' ; export class GraphQLErrorList extends Error { public errors : readonly GraphQLError [ ] ; constructor ( errors , message ? ) { super ( ) ; this . errors = errors ; this . stack = new Error ( ) . stack ; const br = '\r\n' ; const summary = `${ errors . length } error${ errors . length > 1 ? 's' : '' }${ message ? ' ' + message : ':' }` ; const errList = errors . map ( ( err ) => `\t- ${ err . message }` ) . join ( br ) ; this . message = `GraphQLErrorList - ${ summary }${ br }${ errList }` ; } toString ( ) { return this . errors . map ( ( err ) => err . toString ( ) ) . join ( '\r\n' ) ; } }