module Mongo::Error::Notable
A module encapsulating functionality to manage data attached to exceptions in the driver, since the driver does not currently have a single exception hierarchy root.
@since 2.11.0 @api private
Attributes
Returns connection pool generation for the connection on which the error occurred.
@return [ Integer | nil ] Connection pool generation.
Public Instance Methods
Source
# File lib/mongo/error/notable.rb, line 42 def add_note(note) unless @notes @notes = [] end if Lint.enabled? if @notes.include?(note) # The driver makes an effort to not add duplicated notes, by # keeping track of *when* a particular exception should have the # particular notes attached to it throughout the call stack. raise Error::LintError, "Adding a note which already exists in exception #{self}: #{note}" end end @notes << note end
@api private
Source
# File lib/mongo/error/notable.rb, line 33 def notes if @notes @notes.dup else [] end end
Returns an array of strings with additional information about the exception.
@return [ Array<String> ] Additional information strings.
@since 2.11.0 @api public
Source
# File lib/mongo/error/notable.rb, line 64 def to_s super + notes_tail end
@api public
Calls superclass method
Private Instance Methods
Source
# File lib/mongo/error/notable.rb, line 71 def notes_tail msg = '' unless notes.empty? msg += " (#{notes.join(', ')})" end msg end
@api private