Method: Mongo::Error::Labelable#add_label

Defined in:
lib/mongo/error/labelable.rb

#add_label(label) ⇒ 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.

Adds the specified label to the error instance, if the label is not already in the set of labels.

Parameters:

  • label (String)

    The label to add.

Since:

  • 2.0.0



66
67
68
69
# File 'lib/mongo/error/labelable.rb', line 66

def add_label(label)
  @labels ||= []
  @labels << label unless label?(label)
end