Sha256: 4206381a3fb97327d17247c8fc66dc47dc1c3fd3b91fbb1b33b7cf24eca77601

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 Bytes

Contents

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::Error
    def initialize(field_name, schema, field_type, parent_type, received_type)
      possible_types = field_type.kind.resolves? ? schema.possible_types(field_type) : [field_type]
      message = %|The value from "#{field_name}" on "#{parent_type}" could not be resolved to "#{field_type}". (Received: #{received_type.inspect}, Expected: [#{possible_types.map(&:inspect).join(", ")}])|
      super(message)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graphql-1.0.0 lib/graphql/unresolved_type_error.rb