Exception: Ripple::DocumentNotFound
- Includes:
- Translation
- Defined in:
- lib/ripple/document/finders.rb
Overview
Raised by find!
when a document cannot be found with the given key.
begin
Example.find!('badkey')
rescue Ripple::DocumentNotFound
puts 'No Document here!'
end
Instance Method Summary collapse
-
#initialize(keys, found) ⇒ DocumentNotFound
constructor
A new instance of DocumentNotFound.
Methods included from Translation
Constructor Details
#initialize(keys, found) ⇒ DocumentNotFound
Returns a new instance of DocumentNotFound.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ripple/document/finders.rb', line 18 def initialize(keys, found) if keys.empty? super(t("document_not_found.no_key")) elsif keys.size == 1 super(t("document_not_found.one_key", :key => keys.first)) else missing = keys - found.compact.map(&:key) super(t("document_not_found.many_keys", :keys => missing.join(', '))) end end |