Sha256: 5652320b5d353c3a7e6ca2f4d49be69047aac727e3e8caa9023e06d488c683a9

Contents?: true

Size: 1.26 KB

Versions: 29

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true
module GraphQL
  # Error raised when the value provided for a field
  # can't be resolved to one of the possible types for the field.
  class UnresolvedTypeError < GraphQL::RuntimeTypeError
    # @return [Object] The runtime value which couldn't be successfully resolved with `resolve_type`
    attr_reader :value

    # @return [GraphQL::Field] The field whose value couldn't be resolved (`field.type` is type which couldn't be resolved)
    attr_reader :field

    # @return [GraphQL::BaseType] The owner of `field`
    attr_reader :parent_type

    # @return [Object] The return of {Schema#resolve_type} for `value`
    attr_reader :resolved_type

    # @return [Array<GraphQL::BaseType>] The allowed options for resolving `value` to `field.type`
    attr_reader :possible_types

    def initialize(value, field, parent_type, resolved_type, possible_types)
      @value = value
      @field = field
      @parent_type = parent_type
      @resolved_type = resolved_type
      @possible_types = possible_types
      message = %|The value from "#{field.name}" on "#{parent_type}" could not be resolved to "#{field.type}". (Received: #{resolved_type.inspect}, Expected: [#{possible_types.map(&:inspect).join(", ")}])|
      super(message)
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
graphql-1.6.7 lib/graphql/unresolved_type_error.rb
graphql-1.6.6 lib/graphql/unresolved_type_error.rb
graphql-1.6.5 lib/graphql/unresolved_type_error.rb
graphql-1.6.4 lib/graphql/unresolved_type_error.rb
graphql-1.5.15 lib/graphql/unresolved_type_error.rb
graphql-1.6.3 lib/graphql/unresolved_type_error.rb
graphql-1.6.2 lib/graphql/unresolved_type_error.rb
graphql-1.6.1 lib/graphql/unresolved_type_error.rb
graphql-1.6.0 lib/graphql/unresolved_type_error.rb
graphql-1.5.14 lib/graphql/unresolved_type_error.rb
graphql-1.5.13 lib/graphql/unresolved_type_error.rb
graphql-1.5.7.1 lib/graphql/unresolved_type_error.rb
graphql-1.5.12 lib/graphql/unresolved_type_error.rb
graphql-1.5.11 lib/graphql/unresolved_type_error.rb
graphql-1.5.10 lib/graphql/unresolved_type_error.rb
graphql-1.5.9 lib/graphql/unresolved_type_error.rb
graphql-1.5.8 lib/graphql/unresolved_type_error.rb
graphql-1.5.7 lib/graphql/unresolved_type_error.rb
graphql-1.5.6 lib/graphql/unresolved_type_error.rb
graphql-1.5.5 lib/graphql/unresolved_type_error.rb