Exception: Graphiti::Errors::InvalidAttributeAccess

Inherits:
AttributeError show all
Defined in:
lib/graphiti/errors.rb

Instance Attribute Summary

Attributes inherited from AttributeError

#exists, #flag, #guard, #name, #request, #resource

Instance Method Summary collapse

Methods inherited from AttributeError

#action, #resource_name

Constructor Details

#initialize(resource, name, flag, **opts) ⇒ InvalidAttributeAccess

Returns a new instance of InvalidAttributeAccess.



351
352
353
354
# File 'lib/graphiti/errors.rb', line 351

def initialize(resource, name, flag, **opts)
  super
  @guard = opts[:guard]
end

Instance Method Details

#messageObject



356
357
358
359
360
361
362
363
364
365
366
# File 'lib/graphiti/errors.rb', line 356

def message
  msg = super

  msg << if @guard
    ", but the guard #{@guard.inspect} did not pass."
  else
    ", but the attribute was marked #{@flag.inspect} => false."
  end

  msg
end