import CustomGraphQLError from '../errors/customGraphQLError' ; import { GraphQLResponse } from '../HttpClient/GraphQLClient' ; export function throwOnGraphQLErrors ( message ) { return function maybeGraphQLResponse ( response ) { if ( response && response . errors && response . errors . length > 0 ) { throw new CustomGraphQLError ( message , response . errors ) ; } return response ; } ; }