Exception: Graphiti::Errors::TypecastFailed

Inherits:
Base
  • Object
show all
Defined in:
lib/graphiti/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, name, value, error, type_name) ⇒ TypecastFailed

Returns a new instance of TypecastFailed.



562
563
564
565
566
567
568
# File 'lib/graphiti/errors.rb', line 562

def initialize(resource, name, value, error, type_name)
  @resource = resource
  @name = name
  @value = value
  @error = error
  @type_name = type_name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



560
561
562
# File 'lib/graphiti/errors.rb', line 560

def name
  @name
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



560
561
562
# File 'lib/graphiti/errors.rb', line 560

def type_name
  @type_name
end

Instance Method Details

#messageObject



570
571
572
573
574
575
576
577
578
# File 'lib/graphiti/errors.rb', line 570

def message
  <<~MSG
    #{@resource.class}: Failed typecasting #{@name.inspect}! Given #{@value.inspect} but the following error was raised:

    #{@error.message}

    #{@error.backtrace.join("\n")}
  MSG
end