Exception: Mongoid::Errors::CreateCollectionFailure

Inherits:
MongoidError
  • Object
show all
Defined in:
lib/mongoid/errors/create_collection_failure.rb

Overview

Raised when an attempt to create a collection failed.

Constant Summary

Constants inherited from MongoidError

MongoidError::BASE_KEY

Instance Attribute Summary

Attributes inherited from MongoidError

#problem, #resolution, #summary

Instance Method Summary collapse

Methods inherited from MongoidError

#compose_message

Constructor Details

#initialize(collection_name, collection_options, error) ⇒ CreateCollectionFailure

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Instantiate the create collection error.

Parameters:

  • collection_name (String)

    The name of the collection that Mongoid failed to create.

  • collection_options (Hash)

    The options that were used when tried to create the collection.

  • error (Mongo::Error::OperationFailure)

    The error raised when tried to create the collection.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mongoid/errors/create_collection_failure.rb', line 20

def initialize(collection_name, collection_options, error)
  super(
      compose_message(
          "create_collection_failure",
          {
            collection_name: collection_name,
            collection_options: collection_options,
            error: "#{error.class}: #{error.message}"
          }
      )
  )
end