Skip to Content
🎉 Coral now has an MCP Server, check out the docs
DocumentationUtilsgetFirstGraphQLErrorCode

getFirstGraphQLErrorCode

A helper function that returns the first error code from an array of Apollo GraphQL errors.

Import

import { getFirstGraphQLErrorCode } from '@octopus-energy/utils';

Usage

import type { ApolloError } from '@apollo/client'; const errors: ApolloError[] = [ { extensions: { errorCode: 'KT-1111', }, }, { extensions: { errorCode: 'KT-2222', }, }, ]; const firstErrorCode = getFirstGraphQLErrorCode<ApolloError>(errors);

Args

NameDescriptionTypeDefaultRequired
errorsArray of errors from which to get the firstT[]true
Last updated on