Skip to content

The open alternative to Salesforce, designed for AI.

354 B
Raw Blame
import { type GraphQLFormattedError } from 'graphql';

// Guards that throw before UNAUTHENTICATED is attached reach the client as a bare "Unauthorized".
export const isUnauthenticatedGraphQLError = (
  graphQLError: GraphQLFormattedError,
): boolean =>
  graphQLError.extensions?.code === 'UNAUTHENTICATED' ||
  graphQLError.message === 'Unauthorized';