Class: ElasticGraph::Indexer::IndexingFailuresError
- Inherits:
-
Error
- Object
- Error
- ElasticGraph::Indexer::IndexingFailuresError
- Defined in:
- lib/elastic_graph/indexer/indexing_failures_error.rb
Class Method Summary collapse
-
.for(failures:, events:) ⇒ Object
Builds an ‘IndexingFailuresError` with a nicely formatted message for the given array of `FailedEventError`.
Class Method Details
.for(failures:, events:) ⇒ Object
Builds an ‘IndexingFailuresError` with a nicely formatted message for the given array of `FailedEventError`.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/elastic_graph/indexer/indexing_failures_error.rb', line 15 def self.for(failures:, events:) summary = "Got #{failures.size} failure(s) from #{events.size} event(s):" failure_details = failures.map.with_index { |failure, index| "#{index + 1}) #{failure.message}" } = failures.filter_map { |f| f.event["message_id"] }.uniq if .any? = "These failures came from #{message_ids.size} message(s): #{message_ids.join(", ")}." end new([summary, failure_details, ].compact.join("\n\n")) end |