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.



376
377
378
379
# File 'lib/graphiti/errors.rb', line 376

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

Instance Method Details

#messageObject



381
382
383
384
385
386
387
388
389
390
391
# File 'lib/graphiti/errors.rb', line 381

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