class Mongo::Error::NoServerAvailable

Raised if there are no servers available matching the preference.

@since 2.0.0

Public Class Methods

new(server_selector, cluster=nil, msg=nil) click to toggle source

Instantiate the new exception.

@example Instantiate the exception.

Mongo::Error::NoServerAvailable.new(server_selector)

@param [ Hash ] server_selector The server preference that could not be

satisfied.

@param [ Cluster ] cluster The cluster that server selection was

performed on. (added in 2.7.0)

@since 2.0.0

Calls superclass method Mongo::Error::new
# File lib/mongo/error/no_server_available.rb, line 34
def initialize(server_selector, cluster=nil, msg=nil)
  msg ||= "No #{server_selector.name} server is available in cluster: #{cluster.summary} " +
          "with timeout=#{server_selector.server_selection_timeout}, " +
          "LT=#{server_selector.local_threshold}"

  super(msg)
end