Module: Mongo::Error::Notable Private
- Included in:
- Mongo::Error, AuthError
- Defined in:
- lib/mongo/error/notable.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
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 collapse
-
#connection_global_id ⇒ Integer | nil
private
Returns global id of the connection on which the error occurred.
-
#generation ⇒ Integer | nil
private
Returns connection pool generation for the connection on which the error occurred.
-
#service_id ⇒ Object | nil
Returns service id for the connection on which the error occurred.
Instance Method Summary collapse
- #add_note(note) ⇒ Object private
-
#add_notes(*notes) ⇒ Object
private
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 ⇒ Object
Instance Attribute Details
#connection_global_id ⇒ Integer | nil
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 global id of the connection on which the error occurred.
79 80 81 |
# File 'lib/mongo/error/notable.rb', line 79 def connection_global_id @connection_global_id end |
#generation ⇒ Integer | nil
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 connection pool generation for the connection on which the error occurred.
65 66 67 |
# File 'lib/mongo/error/notable.rb', line 65 def generation @generation end |
#service_id ⇒ Object | nil
Returns service id for the connection on which the error occurred.
72 73 74 |
# File 'lib/mongo/error/notable.rb', line 72 def service_id @service_id end |
Instance Method Details
#add_note(note) ⇒ 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.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mongo/error/notable.rb', line 42 def add_note(note) @notes ||= [] if Lint.enabled? && @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 @notes << note end |
#add_notes(*notes) ⇒ 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.
Allows multiple notes to be added in a single call, for convenience.
57 58 59 |
# File 'lib/mongo/error/notable.rb', line 57 def add_notes(*notes) notes.each { |note| add_note(note) } end |
#notes ⇒ Array<String>
Returns an array of strings with additional information about the exception.
33 34 35 36 37 38 39 |
# File 'lib/mongo/error/notable.rb', line 33 def notes if @notes @notes.dup else [] end end |
#to_s ⇒ Object
82 83 84 |
# File 'lib/mongo/error/notable.rb', line 82 def to_s super + notes_tail end |