UNPKG

graphql

Version:

A Query Language and Runtime which can target any service.

23 lines (22 loc) 979 B
/** @category Errors */ import type { Source } from "../language/source.js"; import { GraphQLError } from "./GraphQLError.js"; /** * Produces a GraphQLError representing a syntax error, containing useful * descriptive information about the syntax error's position in the source. * @param source - The GraphQL source containing the syntax error. * @param position - Character offset where the syntax error was encountered. * @param description - Human-readable description of the syntax error. * @returns A GraphQLError located at the syntax error position. * @example * ```ts * import { Source } from 'graphql/language'; * import { syntaxError } from 'graphql/error'; * * const error = syntaxError(new Source('query {'), 7, 'Expected Name'); * * error.message; // => 'Syntax Error: Expected Name' * error.locations; // => [{ line: 1, column: 8 }] * ``` */ export declare function syntaxError(source: Source, position: number, description: string): GraphQLError;