Exception: Deimos::BatchFallbackError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/deimos/exceptions.rb

Overview

Raised when a batch database operation failed and the messages were retried one at a time. Every message that could be saved on its own has been saved; this carries the ones that could not, so that the offending keys show up in logging and error reporting.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(failures) ⇒ BatchFallbackError

Returns a new instance of BatchFallbackError.

Parameters:



15
16
17
18
19
20
# File 'lib/deimos/exceptions.rb', line 15

def initialize(failures)
  @failures = failures
  details = failures.map { |message, error| "#{message.key.inspect} (#{error.message})" }
  super("#{failures.size} message(s) could not be saved individually after the batch " \
        "failed. Failed keys: #{details.join(', ')}")
end

Instance Attribute Details

#failuresArray<Array(Deimos::Message, StandardError)> (readonly)

Returns each message that failed on its own, paired with the error it raised.

Returns:

  • (Array<Array(Deimos::Message, StandardError)>)

    each message that failed on its own, paired with the error it raised.



12
13
14
# File 'lib/deimos/exceptions.rb', line 12

def failures
  @failures
end