/**
 * A [`GraphQL`] GraphQL `cache` event handler that reports
 * [`fetch`](https://developer.mozilla.org/docs/Web/API/Fetch_API), HTTP, parse
 * and GraphQL errors via `console.log()`. In a browser environment the grouped
 * error details are expandable.
 *  kind name param data param { GraphQLCacheKey } data . cacheKey [GraphQL cache] GraphQL [key] GraphQLCacheKey .
 *  param { GraphQLCacheKey } data . cacheValue [GraphQL cache] GraphQL [value] GraphQLCacheValue .
 *  [`GraphQL`] GraphQL `cache` event data.
 *  example <caption>[`GraphQL`] GraphQL initialized to report cache errors.</caption>
 * ```js
 * import { GraphQL, reportCacheErrors } from 'graphql-react'
 *
 * const graphql = new GraphQL()
 * graphql.on('cache', reportCacheErrors)
 * ```
  export function reportCacheErrors ( { cacheKey , cacheValue : { fetchError , httpError , parseError , graphQLErrors } , } ) { if ( fetchError || httpError || parseError || graphQLErrors ) { console . groupCollapsed ( `GraphQL cache errors for key “${ cacheKey }”:` ) ; if ( fetchError ) { console . groupCollapsed ( 'Fetch:' ) ; console . log ( fetchError ) ; console . groupEnd ( ) ; } if ( httpError ) { console . groupCollapsed ( 'HTTP:' ) ; console . log ( `Status: ${ httpError . status }` ) ; console . log ( `Text: ${ httpError . statusText }` ) ; console . groupEnd ( ) ; } if ( parseError ) { console . groupCollapsed ( 'Parse:' ) ; console . log ( parseError ) ; console . groupEnd ( ) ; } if ( graphQLErrors ) { console . groupCollapsed ( 'GraphQL:' ) ; graphQLErrors . forEach ( ( { message } ) => console . log ( message ) ) ; console . groupEnd ( ) ; } console . groupEnd ( ) ; } }