Exception: Sequent::Core::AggregateKeyNotUniqueError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/sequent/core/event_store.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ AggregateKeyNotUniqueError

Returns a new instance of AggregateKeyNotUniqueError.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sequent/core/event_store.rb', line 19

def initialize(message)
  super

  match = message.match(
    # rubocop:disable Layout/LineLength
    /aggregate (\p{Upper}\p{Alnum}*(?:::\p{Upper}\p{Alnum}*)*) (\p{XDigit}{8}-\p{XDigit}{4}-\p{XDigit}{4}-\p{XDigit}{4}-\p{XDigit}{12})/,
    # rubocop:enable Layout/LineLength
  )
  if match
    @aggregate_type = match[1]
    @aggregate_id = match[2]
  end
end

Instance Attribute Details

#aggregate_idObject (readonly)

Returns the value of attribute aggregate_id.



13
14
15
# File 'lib/sequent/core/event_store.rb', line 13

def aggregate_id
  @aggregate_id
end

#aggregate_typeObject (readonly)

Returns the value of attribute aggregate_type.



13
14
15
# File 'lib/sequent/core/event_store.rb', line 13

def aggregate_type
  @aggregate_type
end

Class Method Details

.unique_key_error_message?(message) ⇒ Boolean

Returns:



15
16
17
# File 'lib/sequent/core/event_store.rb', line 15

def self.unique_key_error_message?(message)
  message =~ /duplicate unique key value for aggregate/
end