Sha256: 6db83f1e5a24edd135bb1bd67917a525b7e4f3c6ba4eb1c804620a6e32c5e329

Contents?: true

Size: 509 Bytes

Versions: 139

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

139 entries across 139 versions & 2 rubygems

Version Path
graphql-2.1.6 lib/graphql/parse_error.rb
graphql-2.1.5 lib/graphql/parse_error.rb
graphql-2.1.4 lib/graphql/parse_error.rb
graphql-1.13.20 lib/graphql/parse_error.rb
graphql-2.1.3 lib/graphql/parse_error.rb
graphql-2.1.2 lib/graphql/parse_error.rb
graphql-2.1.1 lib/graphql/parse_error.rb
graphql-2.1.0 lib/graphql/parse_error.rb
graphql-2.0.27 lib/graphql/parse_error.rb
graphql-2.0.26 lib/graphql/parse_error.rb
graphql-2.0.25 lib/graphql/parse_error.rb
graphql-2.0.24 lib/graphql/parse_error.rb
graphql-2.0.23 lib/graphql/parse_error.rb
graphql-2.0.22 lib/graphql/parse_error.rb
graphql-2.0.21 lib/graphql/parse_error.rb
graphql-2.0.20 lib/graphql/parse_error.rb
graphql-2.0.17.2 lib/graphql/parse_error.rb
graphql-2.0.17.1 lib/graphql/parse_error.rb
graphql-2.0.19 lib/graphql/parse_error.rb
graphql-2.0.18 lib/graphql/parse_error.rb