Sha256: 6db83f1e5a24edd135bb1bd67917a525b7e4f3c6ba4eb1c804620a6e32c5e329

Contents?: true

Size: 509 Bytes

Versions: 151

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

151 entries across 151 versions & 2 rubygems

Version Path
graphql-2.3.6 lib/graphql/parse_error.rb
graphql-2.3.5 lib/graphql/parse_error.rb
graphql-2.0.31 lib/graphql/parse_error.rb
graphql-2.3.2 lib/graphql/parse_error.rb
graphql-2.3.1 lib/graphql/parse_error.rb
graphql-1.13.23 lib/graphql/parse_error.rb
graphql-2.3.0 lib/graphql/parse_error.rb
graphql-2.2.14 lib/graphql/parse_error.rb
graphql-2.2.13 lib/graphql/parse_error.rb
graphql-2.2.12 lib/graphql/parse_error.rb
graphql-2.0.29 lib/graphql/parse_error.rb
graphql-2.1.12 lib/graphql/parse_error.rb
graphql-1.13.22 lib/graphql/parse_error.rb
graphql-2.2.11 lib/graphql/parse_error.rb
graphql-2.2.10 lib/graphql/parse_error.rb
graphql-2.2.9 lib/graphql/parse_error.rb
graphql-2.2.8 lib/graphql/parse_error.rb
graphql-2.2.7 lib/graphql/parse_error.rb
graphql-2.2.6 lib/graphql/parse_error.rb
graphql-2.1.11 lib/graphql/parse_error.rb