lib/mongo/server/connection_common.rb
def add_server_diagnostics
        yield
      # Note that the exception should already have been mapped to a
      # Mongo::Error subclass when it gets to this method.
      rescue Error::SocketError, Error::SocketTimeoutError => e
        # Server::Monitor::Connection does not reference its server, but
        # knows its address. Server::Connection delegates the address to its
        # server.
        note = +"on #{address.seed}"
        if respond_to?(:id)
          note << ", connection #{generation}:#{id}"
        end
        # Non-monitoring connections have service id.
        # Monitoring connections do not.
        if respond_to?(:service_id) && service_id
          note << ", service id #{service_id}"
        end
        e.add_note(note)
        if respond_to?(:generation)
          # Non-monitoring connections
          e.generation = generation
          if respond_to?(:description)
            e.service_id = service_id
          end
        end
        raise e
      end
# Yields to the block and, if the block raises an exception, adds a note
# to the exception with the address of the specified server.
#
# This method is intended to add server address information to exceptions
# raised during execution of operations on servers.
Yields to the block and, if the block raises an exception, adds a note
to the exception with the address of the specified server.

This method is intended to add server address information to exceptions
raised during execution of operations on servers.
Yields to the block and if the block raises an exception adds a note to the exception with the address of the specified server . This method is intended to add server address information to exceptions raised during execution of operations on servers .
def add_server_diagnostics
        yield
      rescue Error::SocketError, Error::SocketTimeoutError => e
        note = +"on #{address.seed}"
        if respond_to?(:id)
          note << ", connection #{generation}:#{id}"
        end
        if respond_to?(:service_id) && service_id
          note << ", service id #{service_id}"
        end
        e.add_note(note)
        if respond_to?(:generation)
          e.generation = generation
          if respond_to?(:description)
            e.service_id = service_id
          end
        end
        raise e
      end
def add_server_diagnostics yield rescue Error :: SocketError , Error :: SocketTimeoutError => e note = + "on #{address.seed}" if respond_to? ( :id ) note << ", connection #{generation}:#{id}" end if respond_to? ( :service_id ) && service_id note << ", service id #{service_id}" end e . add_note ( note ) if respond_to? ( :generation ) e . generation = generation if respond_to? ( :description ) e . service_id = service_id end end raise e end
Yields to the block and, if the block raises an exception, adds a note
to the exception with the address of the specified server.
Yields to the block and if the block raises an exception adds a note to the exception with the address of the specified server .
# Note that the exception should already have been mapped to a # Mongo::Error subclass when it gets to this method. # Server::Monitor::Connection does not reference its server, but # knows its address. Server::Connection delegates the address to its # server. # Non-monitoring connections have service id. # Monitoring connections do not. # Non-monitoring connections