UNPKG

graphql-scalars

Version:

A collection of scalar types not included in base GraphQL.

13 lines (12 loc) 851 B
import { GraphQLError, versionInfo } from 'graphql'; export function createGraphQLError(message, options) { if ((versionInfo === null || versionInfo === void 0 ? void 0 : versionInfo.major) >= 17) { return new GraphQLError(message, options); } const nodes = (options === null || options === void 0 ? void 0 : options.nodes) ? Array.isArray(options.nodes) ? options.nodes : [options.nodes] : undefined; return new GraphQLError(message, nodes, options === null || options === void 0 ? void 0 : options.source, options === null || options === void 0 ? void 0 : options.positions, options === null || options === void 0 ? void 0 : options.path, options === null || options === void 0 ? void 0 : options.originalError, options === null || options === void 0 ? void 0 : options.extensions); }