Exception: Chewy::ImportFailed

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

Instance Method Summary collapse

Constructor Details

#initialize(type, import_errors) ⇒ ImportFailed

Returns a new instance of ImportFailed.



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/chewy/errors.rb', line 21

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