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.0.13 lib/graphql/parse_error.rb
graphql-2.0.12 lib/graphql/parse_error.rb
graphql-1.13.15 lib/graphql/parse_error.rb
graphql-2.0.11 lib/graphql/parse_error.rb
graphql-1.13.14 lib/graphql/parse_error.rb
graphql-1.13.13 lib/graphql/parse_error.rb
graphql-2.0.9 lib/graphql/parse_error.rb
graphql-2.0.8 lib/graphql/parse_error.rb
graphql-2.0.7 lib/graphql/parse_error.rb
graphql_cody-1.13.0 lib/graphql/parse_error.rb
graphql-1.13.12 lib/graphql/parse_error.rb
graphql-2.0.6 lib/graphql/parse_error.rb
graphql-2.0.5 lib/graphql/parse_error.rb
graphql-2.0.4 lib/graphql/parse_error.rb
graphql-2.0.3 lib/graphql/parse_error.rb
graphql-1.13.11 lib/graphql/parse_error.rb
graphql-2.0.2 lib/graphql/parse_error.rb
graphql-2.0.1 lib/graphql/parse_error.rb
graphql-1.13.10 lib/graphql/parse_error.rb
graphql-2.0.0 lib/graphql/parse_error.rb