Class: SandthornDriverSequel2::Errors::WrongSnapshotVersionError

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(aggregate, version) ⇒ WrongSnapshotVersionError

Returns a new instance of WrongSnapshotVersionError.



37
38
39
40
41
# File 'lib/sandthorn_driver_sequel_2/errors.rb', line 37

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

Instance Attribute Details

#aggregateObject (readonly)

Returns the value of attribute aggregate.



36
37
38
# File 'lib/sandthorn_driver_sequel_2/errors.rb', line 36

def aggregate
  @aggregate
end

#versionObject (readonly)

Returns the value of attribute version.



36
37
38
# File 'lib/sandthorn_driver_sequel_2/errors.rb', line 36

def version
  @version
end

Instance Method Details

#create_messageObject



43
44
45
46
# File 'lib/sandthorn_driver_sequel_2/errors.rb', line 43

def create_message
  "#{aggregate[:aggregate_type]} with id #{aggregate[:aggregate_id]}: tried to save snapshot with version "+
  "#{version}, but current version is at #{aggregate[:aggregate_version]}"
end