Exception: GraphQL::Schema::Enum::UnresolvedValueError

Inherits:
Error
  • Object
show all
Defined in:
lib/graphql/schema/enum.rb

Instance Method Summary collapse

Constructor Details

#initialize(value:, enum:, context:) ⇒ UnresolvedValueError

Returns a new instance of UnresolvedValueError.



26
27
28
29
30
31
32
33
34
# File 'lib/graphql/schema/enum.rb', line 26

def initialize(value:, enum:, context:)
  fix_message = ", but this isn't a valid value for `#{enum.graphql_name}`. Update the field or resolver to return one of `#{enum.graphql_name}`'s values instead."
  message = if (cp = context[:current_path]) && (cf = context[:current_field])
    "`#{cf.path}` returned `#{value.inspect}` at `#{cp.join(".")}`#{fix_message}"
  else
    "`#{value.inspect}` was returned for `#{enum.graphql_name}`#{fix_message}"
  end
  super(message)
end