Sha256: cd18ede9d390d52e7aaf5c8275bd986689ea58bf8f68dc16b56b1073485ce372

Contents?: true

Size: 540 Bytes

Versions: 107

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true
# test_via: language/parser.rb
module GraphQL
  class ParseError < GraphQL::Error
    attr_reader :line, :col, :query
    def initialize(message, line, col, query, filename: nil)
      if filename
        message += " (#{filename})"
      end

      super(message)
      @line = line
      @col = col
      @query = query
    end

    def to_h
      locations = line ? [{ "line" => line, "column" => col }] : []
      {
        "message" => message,
        "locations" => locations,
      }
    end
  end
end

Version data entries

107 entries across 107 versions & 1 rubygems

Version Path
graphql-1.7.4 lib/graphql/parse_error.rb
graphql-1.7.3 lib/graphql/parse_error.rb
graphql-1.7.2 lib/graphql/parse_error.rb
graphql-1.7.1 lib/graphql/parse_error.rb
graphql-1.7.0 lib/graphql/parse_error.rb
graphql-1.6.8 lib/graphql/parse_error.rb
graphql-1.6.7 lib/graphql/parse_error.rb