Exception: Statecraft::TransitionConflict

Inherits:
Error
  • Object
show all
Defined in:
lib/statecraft/errors.rb

Direct Known Subclasses

StaleTransition

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record:, expected_from:, message: nil) ⇒ TransitionConflict

Returns a new instance of TransitionConflict.



41
42
43
44
45
46
# File 'lib/statecraft/errors.rb', line 41

def initialize(record:, expected_from:, message: nil)
  @record = record
  @expected_from = expected_from
  super(message || "concurrent update detected for #{record.class.name}##{record.id}: " \
                   "expected state #{expected_from.inspect}, another writer got there first")
end

Instance Attribute Details

#expected_fromObject (readonly)

Returns the value of attribute expected_from.



39
40
41
# File 'lib/statecraft/errors.rb', line 39

def expected_from
  @expected_from
end

#recordObject (readonly)

Returns the value of attribute record.



39
40
41
# File 'lib/statecraft/errors.rb', line 39

def record
  @record
end