Class: GraphQL::LoadApplicationObjectFailedError

Inherits:
ExecutionError
  • Object
show all
Defined in:
lib/graphql/load_application_object_failed_error.rb

Overview

Raised when a argument is configured with loads: and the client provides an ID, but no object is loaded for that ID.

See GraphQL::Schema::Member::HasArguments::ArgumentObjectLoader#load_application_object_failed A hook which you can override in resolvers, mutations and input objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argument:, id:, object:, context:) ⇒ LoadApplicationObjectFailedError

Returns a new instance of LoadApplicationObjectFailedError.



28
29
30
31
32
33
34
# File 'lib/graphql/load_application_object_failed_error.rb', line 28

def initialize(argument:, id:, object:, context:)
  @id = id
  @argument = argument
  @object = object
  @context = context
  super("No object found for `#{argument.graphql_name}: #{id.inspect}`")
end

Instance Attribute Details

#argument ⇒ Object (readonly)

Returns

  • GraphQL::Schema::Argument — the argument definition for the argument that was looked up


14
15
16
# File 'lib/graphql/load_application_object_failed_error.rb', line 14

def argument
  @argument
end

#context ⇒ Object (readonly)

Returns

  • GraphQL::Query::Context


26
27
28
# File 'lib/graphql/load_application_object_failed_error.rb', line 26

def context
  @context
end

#id ⇒ Object (readonly)

Returns

  • String — The ID provided by the client


18
19
20
# File 'lib/graphql/load_application_object_failed_error.rb', line 18

def id
  @id
end

#object ⇒ Object (readonly)

Returns

  • Object — The value found with this ID


22
23
24
# File 'lib/graphql/load_application_object_failed_error.rb', line 22

def object
  @object
end