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.



346
347
348
349
# File 'lib/graphiti/errors.rb', line 346

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

Instance Method Details

#messageObject



351
352
353
354
355
356
357
358
359
360
361
# File 'lib/graphiti/errors.rb', line 351

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