Exception: Dry::Ability::AccessDenied

Inherits:
Error
  • Object
show all
Defined in:
lib/dry/ability/exceptions.rb

Constant Summary collapse

DEFAULT_MESSAGE_TEMPLATE =
"The requester is not authorized to %s %p."

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, action, subject) ⇒ AccessDenied

Returns a new instance of AccessDenied.



29
30
31
32
33
# File 'lib/dry/ability/exceptions.rb', line 29

def initialize(message = nil, action, subject)
  @action, @subject = action, subject
  message ||= format(DEFAULT_MESSAGE_TEMPLATE, action, subject.class)
  super(message)
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



27
28
29
# File 'lib/dry/ability/exceptions.rb', line 27

def action
  @action
end

#subjectObject (readonly)

Returns the value of attribute subject.



27
28
29
# File 'lib/dry/ability/exceptions.rb', line 27

def subject
  @subject
end