Sha256: bd6b2059867383f31ca5084454946f1becb678380e90022521417696116dc119

Contents?: true

Size: 909 Bytes

Versions: 14

Compression:

Stored size: 909 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 trying to create a key with an invalid name
  class InvalidKey < 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

14 entries across 14 versions & 1 rubygems

Version Path
mongo_mapper-0.16.0 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.15.6 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.15.5 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.15.4 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.15.3 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.15.2 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.15.1 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.15.0 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.14.0 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.14.0.rc1 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.13.1 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.13.0 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.13.0.beta2 lib/mongo_mapper/exceptions.rb
mongo_mapper-0.13.0.beta1 lib/mongo_mapper/exceptions.rb