Class: SandthornDriverSequel2::Errors::ConcurrencyError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event, aggregate) ⇒ ConcurrencyError

Returns a new instance of ConcurrencyError.



9
10
11
12
13
# File 'lib/sandthorn_driver_sequel_2/errors.rb', line 9

def initialize(event, aggregate)
  @event = event
  @aggregate = aggregate
  super(create_message)
end

Instance Attribute Details

#aggregateObject (readonly)

Returns the value of attribute aggregate.



8
9
10
# File 'lib/sandthorn_driver_sequel_2/errors.rb', line 8

def aggregate
  @aggregate
end

#eventObject (readonly)

Returns the value of attribute event.



8
9
10
# File 'lib/sandthorn_driver_sequel_2/errors.rb', line 8

def event
  @event
end

Instance Method Details

#create_messageObject



15
16
17
18
# File 'lib/sandthorn_driver_sequel_2/errors.rb', line 15

def create_message
  "#{aggregate.aggregate_type} with id #{aggregate.aggregate_id}: " +
  "expected event with version #{aggregate.aggregate_version}, but got #{event.aggregate_version}"
end