class GraphQL::UnresolvedTypeError

Error raised when the value provided for a field can't be resolved to one of the possible types for the field.

Attributes

field[R]

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

parent_type[R]

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

possible_types[R]

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

resolved_type[R]

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

value[R]

@return [Object] The runtime value which couldn't be successfully resolved with `resolve_type`

Public Class Methods

new(value, field, parent_type, resolved_type, possible_types) click to toggle source
Calls superclass method
# File lib/graphql/unresolved_type_error.rb, line 21
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(", ")}]) " \
    "Make sure you have defined a `resolve_type` proc on your schema and that value `#{value.inspect}` " \
    "gets resolved to a valid type. You may need to add your type to `orphan_types` if it implements an " \
    "interface but isn't a return type of any other field."
  super(message)
end