Exception: Shifty::PolicyViolation

Inherits:
PolicyError show all
Defined in:
lib/shifty/errors.rb

Overview

Raised when a task mutates a value it received under a policy that forbids mutation. Wraps the original FrozenError (never masks it) and names the worker, the effective policy, and the object the task tried to mutate, with a heuristic locating that object relative to the handed-off value.

Instance Attribute Summary collapse

Attributes inherited from PolicyError

#policy, #value, #worker

Instance Method Summary collapse

Methods inherited from PolicyError

#cause

Constructor Details

#initialize(worker:, policy:, receiver:, value:, cause:) ⇒ PolicyViolation

Returns a new instance of PolicyViolation.



32
33
34
35
36
37
38
39
# File 'lib/shifty/errors.rb', line 32

def initialize(worker:, policy:, receiver:, value:, cause:)
  @worker = worker
  @policy = policy
  @receiver = receiver
  @value = value
  @wrapped_cause = cause
  super(build_message)
end

Instance Attribute Details

#receiverObject (readonly)

Returns the value of attribute receiver.



30
31
32
# File 'lib/shifty/errors.rb', line 30

def receiver
  @receiver
end