Exception: Chewy::ImportFailed

Inherits:
Error show all
Defined in:
lib/chewy/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(type, import_errors) ⇒ ImportFailed


27
28
29
30
31
32
33
34
35
36
37
# File 'lib/chewy/errors.rb', line 27

def initialize(type, import_errors)
  message = "Import failed for `#{type}` with:\n"
  import_errors.each do |action, action_errors|
    message << "    #{action.to_s.humanize} errors:\n"
    action_errors.each do |error, documents|
      message << "      `#{error}`\n"
      message << "        on #{documents.count} documents: #{documents}\n"
    end
  end
  super message
end