Sha256: 74084f76ec56b2946fe729e2fe89650475763ac0774c8fa592345d3f2a562cd2
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
# encoding: utf-8 module Mongoid #:nodoc module Errors #:nodoc # Raised when querying the database for a document by a specific id which # does not exist. class DocumentNotFound < RuntimeError def initialize(klass, ids) @klass, @identifier = klass, ids.is_a?(Array) ? ids.join(", ") : ids end def message "Document not found for class #{@klass} and id(s) #{@identifier}" end end # Raised when invalid options are passed into a constructor or method. class InvalidOptions < RuntimeError; end # Raised when the database connection has not been set up. class InvalidDatabase < RuntimeError; end # Raised when a persisence method ending in ! fails validation. class Validations < RuntimeError def initialize(errors) @errors = errors end def message "Validation failed: #{@errors.full_messages}" end end # This error is raised when trying to access a Mongo::Collection from an # embedded document. class InvalidCollection < RuntimeError def initialize(klass) @klass = klass end def message "Access to the collection for #{@klass.name} is not allowed " + "since it is an embedded document, please access a collection from " + "the root document" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid-1.1.4 | lib/mongoid/errors.rb |
mongoid-1.1.3 | lib/mongoid/errors.rb |
mongoid-1.1.2 | lib/mongoid/errors.rb |