class

Mongo::Error::Command

Inherits Mongo::Error::Server / Mongo::Error / Exception / Reference / Object

Is raised when the server replies with an error to a command request.

Constants

NOT_MASTER_CODES = {10107, 13435}
NOT_MASTER_MESSAGES = {"not master"}
RECOVERING_CODES = {11600, 11602, 13436, 189, 91}

See: https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#not-master-and-node-is-recovering

RECOVERING_MESSAGES = {"not master or secondary", "node is recovering"}
RESUMABLE_CODES = {63, 133, 150, 234, 13388, 133} + RETRYABLE_CODES

See: https://github.com/mongodb/specifications/blob/f1fcb6aa9751e5ed7eb8e64c0f08f1edf10a859a/source/change-streams/change-streams.rst#resumable-error

RETRYABLE_CODES = {6, 7, 89, 91, 189, 262, 9001, 10107, 11600, 11602, 13435, 13436}

See: https://github.com/mongodb/specifications/blob/master/source/retryable-writes/retryable-writes.rst#determining-retryable-errors

SHUTDOWN_CODES = {11600, 91}

Constructors

new(code, code_name : Nil | String, message, details : BSON | Nil, *, error_labels = Set(String).new)
Source

Instance methods

code
Source
code_name
Source
details
Source
max_time_ms_expired?
Source
not_master?
Source
recovering?
Source
resumable?
Source
retryable_code?
Source
shutdown?
Source
state_change?
Source
to_s(io : IO)

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source