Class: Mongo::Error::NoServiceConnectionAvailable

Inherits:
Error
  • Object
show all
Defined in:
lib/mongo/error/no_service_connection_available.rb

Overview

Raised when the driver requires a connection to a particular service but no matching connections exist in the connection pool.

Since:

  • 2.0.0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, address:, service_id:) ⇒ NoServiceConnectionAvailable

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.

Returns a new instance of NoServiceConnectionAvailable.

Since:

  • 2.0.0



23
24
25
26
27
28
# File 'lib/mongo/error/no_service_connection_available.rb', line 23

def initialize(message, address:, service_id:)
  super(message)

  @address = address
  @service_id = service_id
end

Instance Attribute Details

#addressMongo::Address (readonly)

Returns The address to which a connection was requested.

Returns:

  • (Mongo::Address)

    The address to which a connection was requested.

Since:

  • 2.0.0



32
33
34
# File 'lib/mongo/error/no_service_connection_available.rb', line 32

def address
  @address
end

#service_idnil | Object (readonly)

Returns The service id.

Returns:

  • (nil | Object)

    The service id.

Since:

  • 2.0.0



35
36
37
# File 'lib/mongo/error/no_service_connection_available.rb', line 35

def service_id
  @service_id
end

Class Method Details

.generate(address:, service_id:) ⇒ Object

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.

Since:

  • 2.0.0



38
39
40
41
42
43
44
# File 'lib/mongo/error/no_service_connection_available.rb', line 38

def self.generate(address:, service_id:)
  new(
    "The connection pool for #{address} does not have a connection for service #{service_id}",
    address: address,
    service_id: service_id
  )
end