class Mongo::Error::Command

Overview

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

Direct Known Subclasses

Defined in:

cryomongo/error.cr

Constant Summary

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

Instance Method Summary

Instance methods inherited from class Mongo::Error

add_error_label(label : String) : Nil add_error_label, add_retryable_label(wire_version : Int32) add_retryable_label, add_transient_transaction_label add_transient_transaction_label, add_unknown_transaction_label add_unknown_transaction_label, error_labels : Set(String) error_labels, has_error_label?(label : String) : Bool has_error_label?, retryable_read? retryable_read?, retryable_write? retryable_write?, transient_transaction? transient_transaction?, unknown_transaction? unknown_transaction?

Constructor Detail

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

Instance Method Detail

def code : Int32 #

def code_name : String | Nil #

def details : BSON | Nil #

def max_time_ms_expired? #

def not_master? #

def recovering? #

def resumable? #

def retryable_code? #

def shutdown? #

def state_change? #

def to_s(io : IO) #
Description copied from class Reference

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>