Sha256: aa2dc2b6960a57904fc528acf66cec3e1fe71c5ba66bfca1a026759f1083b2fa
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
module SandthornDriverSequel2::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_sequel_2-0.0.2 | lib/sandthorn_driver_sequel_2/errors.rb |
sandthorn_driver_sequel_2-0.0.1 | lib/sandthorn_driver_sequel_2/errors.rb |