Module: Mongo::Error::Notable Private
Overview
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.
Instance Attribute Summary
-
#connection_global_id ⇒ Integer | nil
rw
Internal use only
Returns global id of the connection on which the error occurred.
-
#generation ⇒ Integer | nil
rw
Internal use only
Returns connection pool generation for the connection on which the error occurred.
-
#service_id ⇒ Object | nil
rw
Returns service id for the connection on which the error occurred.
Instance Method Summary
- #add_note(note) Internal use only
-
#add_notes(*notes)
Internal use only
Allows multiple notes to be added in a single call, for convenience.
-
#notes ⇒ Array<String>
Returns an array of strings with additional information about the exception.
- #to_s
- #notes_tail private Internal use only
Instance Attribute Details
#connection_global_id ⇒ Integer
| nil
(rw)
Returns global id of the connection on which the error occurred.
# File 'lib/mongo/error/notable.rb', line 85
attr_accessor :connection_global_id
#generation ⇒ Integer
| nil
(rw)
Returns connection pool generation for the connection on which the error occurred.
# File 'lib/mongo/error/notable.rb', line 71
attr_accessor :generation
#service_id ⇒ Object
| nil
(rw)
Returns service id for the connection on which the error occurred.
# File 'lib/mongo/error/notable.rb', line 78
attr_accessor :service_id
Instance Method Details
#add_note(note)
# File 'lib/mongo/error/notable.rb', line 45
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
#add_notes(*notes)
Allows multiple notes to be added in a single call, for convenience.
#notes ⇒ Array
<String
>
Returns an array of strings with additional information about the exception.
# File 'lib/mongo/error/notable.rb', line 36
def notes if @notes @notes.dup else [] end end
#notes_tail (private)
#to_s
# File 'lib/mongo/error/notable.rb', line 88
def to_s super + notes_tail end