Sha256: 376d6df07ec418855074d3c98e050ac2f4d66c0b795db41552fb97e932b3ed2d

Contents?: true

Size: 818 Bytes

Versions: 3

Compression:

Stored size: 818 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  # generic MM error
  class Error < StandardError; end

  # raised when document expected but not found
  class DocumentNotFound < Error; end

  # raised when trying to connect using uri with incorrect scheme
  class InvalidScheme < Error; end

  # raised when trying to do something not supported, mostly for edocs
  class NotSupported < Error; end

  # raised when document not valid and using !
  class DocumentNotValid < Error
    attr_reader :document
  
    def initialize(document)
      @document = document
      super("Validation failed: #{document.errors.full_messages.join(", ")}")
    end
  end

  class AccessibleOrProtected < Error
    def initialize(name)
      super("Declare either attr_protected or attr_accessible for #{name}, but not both.")
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
mongo_mapper-0.12.0 lib/mongo_mapper/exceptions.rb
lookout-mongo_mapper-0.11.3 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.11.2 lib/mongo_mapper/exceptions.rb