Sha256: 6db83f1e5a24edd135bb1bd67917a525b7e4f3c6ba4eb1c804620a6e32c5e329

Contents?: true

Size: 509 Bytes

Versions: 137

Compression:

Stored size: 509 Bytes

Contents

# frozen_string_literal: true
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

137 entries across 137 versions & 2 rubygems

Version Path
graphql-2.4.9 lib/graphql/parse_error.rb
graphql-2.4.8 lib/graphql/parse_error.rb
graphql-2.4.7 lib/graphql/parse_error.rb
graphql-2.4.6 lib/graphql/parse_error.rb
graphql-2.4.5 lib/graphql/parse_error.rb
graphql-2.4.4 lib/graphql/parse_error.rb
graphql-2.4.3 lib/graphql/parse_error.rb
graphql-2.4.2 lib/graphql/parse_error.rb
graphql-2.4.1 lib/graphql/parse_error.rb
graphql-2.4.0 lib/graphql/parse_error.rb
graphql-2.3.20 lib/graphql/parse_error.rb
graphql-2.3.19 lib/graphql/parse_error.rb
graphql-2.3.18 lib/graphql/parse_error.rb
graphql-2.3.17 lib/graphql/parse_error.rb
graphql-2.3.16 lib/graphql/parse_error.rb
graphql-2.3.15 lib/graphql/parse_error.rb
graphql-2.3.14 lib/graphql/parse_error.rb
graphql-2.3.13 lib/graphql/parse_error.rb
graphql-2.3.12 lib/graphql/parse_error.rb
graphql-2.3.11 lib/graphql/parse_error.rb