Skip to Content
🎉 Coral x Panda has been released 🎉 Read the Migration Guide
DocumentationUtilsgetFirstGraphQLErrorCode

getFirstGraphQLErrorCode

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

Import

import { getFirstGraphQLErrorCode } from '@krakentech/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