Exception: E3DB::ConflictError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/e3db/client.rb

Overview

Exception thrown by E3DB::Client#update when a concurrent modification is detected. Upon catching this exception, a client should re-fetch the affected record and retry the update operation.

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ ConflictError

Returns a new instance of ConflictError.



42
43
44
45
46
47
48
49
50
# File 'lib/e3db/client.rb', line 42

def initialize(record)
  if record.is_a? E3DB::Record
    super('Conflict updating record: ' + record.meta.record_id)
  else
    super('Conflict updating record: ' + record)
  end

  @record = record
end

Instance Method Details

#recordRecord

Return the record from the failing update attempt.

Returns:

  • (Record)

    the affected record



55
56
57
# File 'lib/e3db/client.rb', line 55

def record
  @record
end