Exception: Mongo::Error::InvalidServerPreference

Inherits:
Mongo::Error
  • Object
show all
Defined in:
lib/mongo/error/invalid_server_preference.rb

Overview

Raised when an invalid server preference is provided.

Since:

  • 2.0.0

Constant Summary collapse

NO_TAG_SUPPORT =

Error message when tags are specified for a read preference that cannot support them.

Since:

  • 2.4.0

'This read preference cannot be combined with tags.'.freeze
NO_MAX_STALENESS_SUPPORT =

Error message when a max staleness is specified for a read preference that cannot support it.

Since:

  • 2.4.0

'max_staleness cannot be set for this read preference.'.freeze
NO_HEDGE_SUPPORT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Error message when hedge is specified for a read preference that does not support it.

Since:

  • 2.0.0

'The hedge option cannot be set for this read preference'.freeze
INVALID_MAX_STALENESS =
Deprecated.

Error message for when the max staleness is not at least twice the heartbeat frequency.

Since:

  • 2.4.0

"`max_staleness` value is too small. It must be at least " +
        "`ServerSelector::SMALLEST_MAX_STALENESS_SECONDS` and (the cluster's heartbeat_frequency " +
"setting + `Cluster::IDLE_WRITE_PERIOD_SECONDS`).".freeze
NO_MAX_STALENESS_WITH_LEGACY_SERVER =

Error message when max staleness cannot be used because one or more servers has version < 3.4.

Since:

  • 2.4.0

'max_staleness can only be set for a cluster in which ' +
'each server is at least version 3.4.'.freeze

Constants inherited from Mongo::Error

BAD_VALUE, CODE, CURSOR_NOT_FOUND, ERR, ERRMSG, ERROR, TRANSIENT_TRANSACTION_ERROR_LABEL, UNKNOWN_ERROR, UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL, WRITE_CONCERN_ERROR, WRITE_CONCERN_ERRORS, WRITE_ERRORS

Instance Attribute Summary

Attributes included from Notable

#connection_global_id, #generation, #service_id

Instance Method Summary collapse

Methods inherited from Mongo::Error

#change_stream_resumable?, #write_concern_error_label?, #write_concern_error_labels

Methods included from ChangeStreamResumable

#change_stream_resumable?

Methods included from WriteRetryable

#write_retryable?

Methods included from Labelable

#add_label, #label?, #labels

Methods included from Notable

#add_note, #add_notes, #notes, #to_s

Constructor Details

#initialize(message) ⇒ InvalidServerPreference

Instantiate the new exception.

Examples:

Instantiate the exception.

Mongo::Error::InvalidServerPreference.new

Parameters:

  • message (String)

    The error message.

Since:

  • 2.0.0



63
64
65
# File 'lib/mongo/error/invalid_server_preference.rb', line 63

def initialize(message)
  super(message)
end