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
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
errors | Array of errors from which to get the first | T[] | true |
Last updated on