Exception: Yes::Core::CommandHandling::ConcurrentUpdateError

Inherits:
Error
  • Object
show all
Defined in:
lib/yes/core/command_handling/command_executor.rb

Overview

Raised when multiple processes attempt to update the same aggregate concurrently This error is thrown when the pending_update_since mechanism detects a conflict

Instance Attribute Summary

Attributes inherited from Error

#extra

Instance Method Summary collapse

Constructor Details

#initialize(aggregate_class:, aggregate_id:, original_error: nil) ⇒ ConcurrentUpdateError

Initializes a new ConcurrentUpdateError

Parameters:

  • aggregate_class (Class)

    The aggregate class

  • aggregate_id (String)

    The ID of the aggregate being updated

  • original_error (Exception) (defaults to: nil)

    The underlying database error



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/yes/core/command_handling/command_executor.rb', line 14

def initialize(aggregate_class:, aggregate_id:, original_error: nil)
  message = build_error_message(aggregate_class, aggregate_id, original_error)

  super(message, extra: {
    aggregate_class: aggregate_class.name,
    aggregate_id: aggregate_id,
    context: aggregate_class.context,
    stream_name: aggregate_class.aggregate,
    original_error: original_error&.message
  })
end