Exception: GQL::Errors::NoMethodError

Inherits:
GQL::Error
  • Object
show all
Defined in:
lib/gql/errors.rb

Instance Attribute Summary collapse

Attributes inherited from GQL::Error

#code, #handle

Instance Method Summary collapse

Methods inherited from GQL::Error

#as_json

Constructor Details

#initialize(field_class, id, cause) ⇒ NoMethodError

Returns a new instance of NoMethodError.



93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/gql/errors.rb', line 93

def initialize(field_class, id, cause)
  @cause = cause

  msg =  "Undefined method `#{id}' for #{field_class}. "
  msg << "Did you try to add a field of type `#{id}'? "
  msg << "If so, you have to register your field type first "
  msg << "like this: `GQL.field_types[:#{id}] = My#{id.to_s.camelize}'. "
  msg << "The following field types are currently registered: "
  msg << GQL.field_types.keys.sort.map { |key| "`#{key}'" }.to_sentence

  super(msg, 124)
end

Instance Attribute Details

#causeObject (readonly)

Returns the value of attribute cause.



91
92
93
# File 'lib/gql/errors.rb', line 91

def cause
  @cause
end