模块:Mongo::Error::Notable Private

包含在:
Mongo::ErrorAuthError
定义于:
lib/ Mongo/error/notable.rb

Overview

该模块是私有 API 的一部分。 您应尽可能避免使用此模块,因为它将来可能会被删除或更改。

封装用于管理附加到驱动程序中异常的数据的功能的模块,因为驱动程序当前没有单个异常层次结构根。

由于:

  • 2.11.0

实例属性摘要折叠

实例方法摘要折叠

实例属性详细信息

# connection_global_idInteger | nil

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

返回发生错误的连接的全局 ID。

返回:

  • ( Integer | nil )

    连接全局 ID。

由于:

  • 2.11.0



79
80
81
# File 'lib/ Mongo/error/notable.rb', line 79

def connection_global_id
  @connection_global_id
end

#生成整数 | nil

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

返回发生错误的连接的连接池生成。

返回:

  • ( Integer | nil )

    连接池生成。

由于:

  • 2.11.0



65
66
67
# File 'lib/ Mongo/error/notable.rb', line 65

def 生成
  @Generation
end

# service_id对象 | nil

返回发生错误的连接的服务 ID。

返回:

  • ( Object | nil )

    服务 ID。

由于:

  • 2.11.0



72
73
74
# File 'lib/ Mongo/error/notable.rb', line 72

def service_id
  @service_id
end

实例方法详细信息

# add_note (note) ⇒对象

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

由于:

  • 2.11.0



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ Mongo/error/notable.rb', line 42

def add_note(注意)
  @notes ||= []
  if Lint.已启用? && @notes.包括?(注意)
    # 驱动程序会努力不添加重复的注释,方法是
    # 跟踪*何时*出现特定异常应该具有
    # 在整个调用堆栈中附加的特定注释。
    提高 错误::LintError, "添加异常中已存在的注释#{ self } : #{ note } "
  end

  @notes << 注意
end

# add_notes (*notes) ⇒对象

此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。

为方便起见,允许在一次调用中添加多个注释。

由于:

  • 2.11.0



57
58
59
# File 'lib/ Mongo/error/notable.rb', line 57

def add_notes(*注意事项)
  注意事项. { |注意| add_note(注意) }
end

#notesArray<String>

返回一个字符串数组,其中包含有关异常的附加信息。

返回:

  • ( Array<String> )

    附加信息字符串。

由于:

  • 2.11.0



33
34
35
36
37
38
39
# File 'lib/ Mongo/error/notable.rb', line 33

def 注意事项
  if @notes
    @notes.dup
  else
    []
  end
end

# to_s对象

由于:

  • 2.11.0



82
83
84
# File 'lib/ Mongo/error/notable.rb', line 82

def to_s
   + notes_tail
end