Sha256: 1fa84583dd99c53df6c1bc7d26fafe7bf3f4b484344a4570efef9913fe5eb11e

Contents?: true

Size: 877 Bytes

Versions: 5

Compression:

Stored size: 877 Bytes

Contents

module Chewy
  class Error < StandardError
  end

  class UndefinedIndex < Error
  end

  class UndefinedType < Error
  end

  class UnderivableType < Error
  end

  class UndefinedUpdateStrategy < Error
    def initialize type
      super <<-MESSAGE
Index update strategy is undefined in current context.
Please wrap your code with `Chewy.strategy(:strategy_name) block.`
      MESSAGE
    end
  end

  class DocumentNotFound < Error
  end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chewy-0.8.3 lib/chewy/errors.rb
chewy-0.8.2 lib/chewy/errors.rb
chewy-0.8.1 lib/chewy/errors.rb
chewy-0.8.0 lib/chewy/errors.rb
chewy-0.7.0 lib/chewy/errors.rb