Sha256: 7de8cf278d2f1ed4199bbe47b06667eb3118f9b4395a334287b5591117ec3651
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
module SandthornDriverEventStore::Errors Error = Class.new(StandardError) InternalError = Class.new(Error) NoAggregateError = Class.new(Error) EventFormatError = Class.new(Error) class ConcurrencyError < Error attr_reader :event, :aggregate def initialize(event, aggregate) @event = event @aggregate = aggregate super(create_message) end def create_message "#{aggregate.aggregate_type} with id #{aggregate.aggregate_id}: " + "expected event with version #{aggregate.aggregate_version}, but got #{event.aggregate_version}" end end class WrongAggregateVersionError < Error; def initialize(aggregate, version) @aggregate = aggregate @version = version super(create_message) end def create_message "#{@aggregate[:aggregate_type]} with id #{@aggregate[:aggregate_id]}" + " should be at version #{@version}" + " but was #{@aggregate[:aggregate_version]} in the event store." end end class WrongSnapshotVersionError < Error attr_reader :aggregate, :version def initialize(aggregate, version) @aggregate = aggregate @version = version super(create_message) end 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sandthorn_driver_event_store-0.1.0 | lib/sandthorn_driver_event_store/errors.rb |
sandthorn_driver_event_store-0.0.1 | lib/sandthorn_driver_event_store/errors.rb |