Sha256: 562afa008048e745726400bac8c767f05863f5a8849ba8a061d86b75fe24292e

Contents?: true

Size: 745 Bytes

Versions: 4

Compression:

Stored size: 745 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

  class ObjectType
    # @deprecated Use {GraphQL::UnresolvedTypeError} instead
    UnresolvedTypeError = GraphQL::UnresolvedTypeError
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
graphql-0.19.4 lib/graphql/unresolved_type_error.rb
graphql-0.19.3 lib/graphql/unresolved_type_error.rb
graphql-0.19.2 lib/graphql/unresolved_type_error.rb
graphql-0.19.1 lib/graphql/unresolved_type_error.rb