class Mongo::Error::InvalidReplacementDocument

Exception raised if the object is not a valid replacement document.

Constants

MESSAGE

The error message.

@deprecated

Public Class Methods

message(key) click to toggle source

Construct the error message.

@param [ String ] key The invalid key.

@return [ String ] The error message.

@api private

# File lib/mongo/error/invalid_replacement_document.rb, line 36
def self.message(key)
  message = "Invalid replacement document provided. Replacement documents "
  message += "must not contain atomic modifiers. The \"#{key}\" key is invalid."
  message
end
new(key: nil) click to toggle source

Instantiate the new exception.

@param [ String ] :key The invalid key.

Calls superclass method Mongo::Error::new
# File lib/mongo/error/invalid_replacement_document.rb, line 55
def initialize(key: nil)
  super(self.class.message(key))
end
warn(logger, key) click to toggle source

Send and cache the warning.

@api private

# File lib/mongo/error/invalid_replacement_document.rb, line 45
def self.warn(logger, key)
  @warned ||= begin
    logger.warn(message(key))
    true
  end
end