Exception: Humanoid::Errors::DocumentNotFound

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/humanoid/errors.rb

Overview

Raised when querying the database for a document by a specific id which does not exist. If multiple ids were passed then it will display all of those.

Example:

DocumentNotFound.new(Person, ["1", "2"])

Instance Method Summary collapse

Constructor Details

#initialize(klass, ids) ⇒ DocumentNotFound

Returns a new instance of DocumentNotFound.



13
14
15
# File 'lib/humanoid/errors.rb', line 13

def initialize(klass, ids)
  @klass, @identifier = klass, ids.is_a?(Array) ? ids.join(", ") : ids
end

Instance Method Details

#messageObject



16
17
18
# File 'lib/humanoid/errors.rb', line 16

def message
  "Document not found for class #{@klass} and id(s) #{@identifier}"
end