Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function throwHttpGraphQLError(
statusCode: number,
errors: Array,
options?: Pick,
extensions?: GraphQLExecutionResult['extensions'],
): never {
const defaultHeaders = { 'Content-Type': 'application/json' };
// force no-cache on PersistedQuery errors
const headers = hasPersistedQueryError(errors)
? {
...defaultHeaders,
'Cache-Control': 'private, no-cache, must-revalidate',
}
: defaultHeaders;
type Result =
& Pick
& { errors: E[] | ApolloError[] }
const result: Result = {
errors: options
? formatApolloErrors(errors, {
debug: options.debug,
formatter: options.formatError,
})