Method: GraphQL::Client::Errors#include?

Defined in:
lib/graphql/client/errors.rb

#include?(field) ⇒ Boolean Also known as: has_key?, key?

Public: Check if there are any errors on a given field.

data.errors.messages # => {"node"=>["couldn't find node by id", "unauthorized"]}
data.errors.include?("node")    # => true
data.errors.include?("version") # => false

Returns true if the error messages include an error for the given field, otherwise false.

Returns:

  • (Boolean)

145
146
147
# File 'lib/graphql/client/errors.rb', line 145

def include?(field)
  self[field].any?
end