class GraphQL::Schema::Enum::UnresolvedValueError
This is raised when either:
-
A resolver returns a value which doesn’t match any of the enum’s configured values;
-
Or, the resolver returns a value which matches a value, but that value’s
authorized?check returns false.
In either case, the field should be modified so that the invalid value isn’t returned.
GraphQL::Schema::Enum subclasses get their own subclass of this error, so that bug trackers can better show where they came from.
Public Class Methods
# File lib/graphql/schema/enum.rb, line 39 def initialize(value:, enum:, context:, authorized:) fix_message = if authorized == false ", but this value was unauthorized. Update the field or resolver to return a different value in this case (or return `nil`)." else ", 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." end 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
Calls superclass method