syntaxError.js.flow 483 B

12345678910111213141516171819
  1. // @flow strict
  2. import { type Source } from '../language/source';
  3. import { GraphQLError } from './GraphQLError';
  4. /**
  5. * Produces a GraphQLError representing a syntax error, containing useful
  6. * descriptive information about the syntax error's position in the source.
  7. */
  8. export function syntaxError(
  9. source: Source,
  10. position: number,
  11. description: string,
  12. ): GraphQLError {
  13. return new GraphQLError(`Syntax Error: ${description}`, undefined, source, [
  14. position,
  15. ]);
  16. }