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.10.11 lib/graphql/parse_error.rb
graphql-1.9.20 lib/graphql/parse_error.rb
graphql-1.10.10 lib/graphql/parse_error.rb
graphql-1.10.9 lib/graphql/parse_error.rb
graphql-1.10.8 lib/graphql/parse_error.rb
graphql-1.10.7 lib/graphql/parse_error.rb
graphql-1.10.6 lib/graphql/parse_error.rb
graphql-1.10.5 lib/graphql/parse_error.rb
graphql-1.10.4 lib/graphql/parse_error.rb
graphql-1.10.3 lib/graphql/parse_error.rb
graphql-1.10.2 lib/graphql/parse_error.rb
graphql-1.9.19 lib/graphql/parse_error.rb
graphql-1.10.1 lib/graphql/parse_error.rb
graphql-1.10.0 lib/graphql/parse_error.rb
graphql-1.10.0.pre4 lib/graphql/parse_error.rb
graphql-1.9.18 lib/graphql/parse_error.rb
graphql-1.10.0.pre3 lib/graphql/parse_error.rb
graphql-1.9.17 lib/graphql/parse_error.rb
graphql-1.10.0.pre2 lib/graphql/parse_error.rb
graphql-1.9.16 lib/graphql/parse_error.rb