123456789_123456789_123456789_123456789_123456789_

Exception: Mongo::Error

Relationships & Source Files
Namespace Children
Modules:
Classes:
Exceptions:
AuthError, BadLoadBalancerTarget, BulkWriteError, ClientClosed, ClosedStream, ConnectionPerished, ConnectionUnavailable, CredentialCheckError, CryptError, ExtraFileChunk, FailedStringPrepValidation, FileNotFound, HandshakeError, InsufficientIterationCount, InternalDriverError, InvalidAddress, InvalidApplicationName, InvalidBulkOperation, InvalidBulkOperationType, InvalidCollectionName, InvalidConfigOption, InvalidCursorOperation, InvalidDatabaseName, InvalidDocument, InvalidFile, InvalidFileRevision, InvalidMaxConnecting, InvalidMinPoolSize, InvalidNonce, InvalidReadConcern, InvalidReadOption, InvalidReplacementDocument, InvalidServerAuthHost, InvalidServerAuthResponse, InvalidServerPreference, InvalidSession, InvalidSignature, InvalidTXTRecord, InvalidTransactionOperation, InvalidURI, InvalidUpdateDocument, InvalidWriteConcern, KmsError, LintError, MaxBSONSize, MaxMessageSize, MismatchedDomain, MissingConnection, MissingFileChunk, MissingPassword, MissingResumeToken, MissingScramServerSignature, MissingServiceId, MongocryptdSpawnError, MultiIndexDrop, NeedPrimaryServer, NoSRVRecords, NoServerAvailable, NoServiceConnectionAvailable, OperationFailure, PoolClearedError, PoolClosedError, PoolError, PoolPausedError, RaiseOriginalError, ServerApiConflict, ServerApiNotSupported, ServerCertificateRevoked, ServerNotUsable, SessionEnded, SessionNotMaterialized, SessionsNotSupported, SnapshotSessionInvalidServerVersion, SnapshotSessionTransactionProhibited, SocketError, SocketTimeoutError, TransactionsNotSupported, UnchangeableCollectionOption, UnexpectedChunkLength, UnexpectedResponse, UnknownPayloadType, UnmetDependency, UnsupportedArrayFilters, UnsupportedCollation, UnsupportedFeatures, UnsupportedMessageType, UnsupportedOption
Extension / Inclusion / Inheritance Descendants
Subclasses:
BadLoadBalancerTarget, BulkWriteError, ClientClosed, ClosedStream, ConnectionPerished, ConnectionUnavailable, CryptError, ExtraFileChunk, FailedStringPrepValidation, FileNotFound, HandshakeError, InsufficientIterationCount, InternalDriverError, InvalidAddress, InvalidApplicationName, InvalidBulkOperation, InvalidBulkOperationType, InvalidCollectionName, InvalidConfigOption, InvalidCursorOperation, InvalidDatabaseName, InvalidDocument, InvalidFile, InvalidFileRevision, InvalidMaxConnecting, InvalidMinPoolSize, InvalidNonce, InvalidReadConcern, InvalidReadOption, InvalidReplacementDocument, InvalidServerPreference, InvalidSession, InvalidSignature, InvalidTXTRecord, InvalidTransactionOperation, InvalidURI, InvalidUpdateDocument, InvalidWriteConcern, KmsError, LintError, MaxBSONSize, MaxMessageSize, MismatchedDomain, MissingConnection, MissingFileChunk, MissingPassword, MissingResumeToken, MissingScramServerSignature, MissingServiceId, MongocryptdSpawnError, MultiIndexDrop, NeedPrimaryServer, NoSRVRecords, NoServerAvailable, NoServiceConnectionAvailable, OperationFailure, PoolClearedError, PoolClosedError, PoolError, PoolPausedError, ServerApiConflict, ServerApiNotSupported, ServerCertificateRevoked, ServerNotUsable, SessionEnded, SessionNotMaterialized, SessionsNotSupported, SnapshotSessionInvalidServerVersion, SnapshotSessionTransactionProhibited, SocketError, SocketTimeoutError, TransactionsNotSupported, UnchangeableCollectionOption, UnexpectedChunkLength, UnexpectedResponse, UnknownPayloadType, UnmetDependency, UnsupportedArrayFilters, UnsupportedCollation, UnsupportedFeatures, UnsupportedMessageType, UnsupportedOption, Server::AppMetadata::Environment::MissingVariable, Server::AppMetadata::Environment::TooManyEnvironments, Server::AppMetadata::Environment::TypeMismatch, Server::AppMetadata::Environment::ValueTooLong
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, StandardError
Instance Chain:
Inherits: StandardError
  • Object
Defined in: lib/mongo/error.rb,
lib/mongo/error/auth_error.rb,
lib/mongo/error/bad_load_balancer_target.rb,
lib/mongo/error/bulk_write_error.rb,
lib/mongo/error/change_stream_resumable.rb,
lib/mongo/error/client_closed.rb,
lib/mongo/error/closed_stream.rb,
lib/mongo/error/connection_check_out_timeout.rb,
lib/mongo/error/connection_perished.rb,
lib/mongo/error/connection_unavailable.rb,
lib/mongo/error/credential_check_error.rb,
lib/mongo/error/crypt_error.rb,
lib/mongo/error/extra_file_chunk.rb,
lib/mongo/error/failed_string_prep_validation.rb,
lib/mongo/error/file_not_found.rb,
lib/mongo/error/handshake_error.rb,
lib/mongo/error/insufficient_iteration_count.rb,
lib/mongo/error/internal_driver_error.rb,
lib/mongo/error/invalid_address.rb,
lib/mongo/error/invalid_application_name.rb,
lib/mongo/error/invalid_bulk_operation.rb,
lib/mongo/error/invalid_bulk_operation_type.rb,
lib/mongo/error/invalid_collection_name.rb,
lib/mongo/error/invalid_config_option.rb,
lib/mongo/error/invalid_cursor_operation.rb,
lib/mongo/error/invalid_database_name.rb,
lib/mongo/error/invalid_document.rb,
lib/mongo/error/invalid_file.rb,
lib/mongo/error/invalid_file_revision.rb,
lib/mongo/error/invalid_max_connecting.rb,
lib/mongo/error/invalid_min_pool_size.rb,
lib/mongo/error/invalid_nonce.rb,
lib/mongo/error/invalid_read_concern.rb,
lib/mongo/error/invalid_read_option.rb,
lib/mongo/error/invalid_replacement_document.rb,
lib/mongo/error/invalid_server_auth_host.rb,
lib/mongo/error/invalid_server_auth_response.rb,
lib/mongo/error/invalid_server_preference.rb,
lib/mongo/error/invalid_session.rb,
lib/mongo/error/invalid_signature.rb,
lib/mongo/error/invalid_transaction_operation.rb,
lib/mongo/error/invalid_txt_record.rb,
lib/mongo/error/invalid_update_document.rb,
lib/mongo/error/invalid_uri.rb,
lib/mongo/error/invalid_write_concern.rb,
lib/mongo/error/kms_error.rb,
lib/mongo/error/labelable.rb,
lib/mongo/error/lint_error.rb,
lib/mongo/error/max_bson_size.rb,
lib/mongo/error/max_message_size.rb,
lib/mongo/error/mismatched_domain.rb,
lib/mongo/error/missing_connection.rb,
lib/mongo/error/missing_file_chunk.rb,
lib/mongo/error/missing_password.rb,
lib/mongo/error/missing_resume_token.rb,
lib/mongo/error/missing_scram_server_signature.rb,
lib/mongo/error/missing_service_id.rb,
lib/mongo/error/mongocryptd_spawn_error.rb,
lib/mongo/error/multi_index_drop.rb,
lib/mongo/error/need_primary_server.rb,
lib/mongo/error/no_server_available.rb,
lib/mongo/error/no_service_connection_available.rb,
lib/mongo/error/no_srv_records.rb,
lib/mongo/error/notable.rb,
lib/mongo/error/operation_failure.rb,
lib/mongo/error/parser.rb,
lib/mongo/error/pool_cleared_error.rb,
lib/mongo/error/pool_closed_error.rb,
lib/mongo/error/pool_error.rb,
lib/mongo/error/pool_paused_error.rb,
lib/mongo/error/raise_original_error.rb,
lib/mongo/error/read_write_retryable.rb,
lib/mongo/error/sdam_error_detection.rb,
lib/mongo/error/server_api_conflict.rb,
lib/mongo/error/server_api_not_supported.rb,
lib/mongo/error/server_certificate_revoked.rb,
lib/mongo/error/server_not_usable.rb,
lib/mongo/error/session_ended.rb,
lib/mongo/error/session_not_materialized.rb,
lib/mongo/error/sessions_not_supported.rb,
lib/mongo/error/snapshot_session_invalid_server_version.rb,
lib/mongo/error/snapshot_session_transaction_prohibited.rb,
lib/mongo/error/socket_error.rb,
lib/mongo/error/socket_timeout_error.rb,
lib/mongo/error/transactions_not_supported.rb,
lib/mongo/error/unchangeable_collection_option.rb,
lib/mongo/error/unexpected_chunk_length.rb,
lib/mongo/error/unexpected_response.rb,
lib/mongo/error/unknown_payload_type.rb,
lib/mongo/error/unmet_dependency.rb,
lib/mongo/error/unsupported_array_filters.rb,
lib/mongo/error/unsupported_collation.rb,
lib/mongo/error/unsupported_features.rb,
lib/mongo/error/unsupported_message_type.rb,
lib/mongo/error/unsupported_option.rb,
lib/mongo/error/write_retryable.rb

Overview

Base error class for all ::Mongo related errors.

Since:

  • 2.0.0

Constant Summary

Class Method Summary

Instance Attribute Summary

ChangeStreamResumable - Included

#change_stream_resumable?

Can the change stream on which this error occurred be resumed, provided the operation that triggered this error was a getMore?

WriteRetryable - Included

Notable - Included

#connection_global_id

Returns global id of the connection on which the error occurred.

#generation

Returns connection pool generation for the connection on which the error occurred.

#service_id

Returns service id for the connection on which the error occurred.

Instance Method Summary

Labelable - Included

#add_label

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

#label?

Does the error have the given label?

#labels

Gets the set of labels associated with the error.

Notable - Included

#add_note,
#add_notes

Allows multiple notes to be added in a single call, for convenience.

#notes

Returns an array of strings with additional information about the exception.

#to_s, #notes_tail

Constructor Details

.new(msg = nil) ⇒ Error

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/error.rb', line 112

def initialize(msg = nil)
  super
  @write_concern_error_labels = []
end

Instance Attribute Details

#change_stream_resumable?true, false (readonly)

Can the change stream on which this error occurred be resumed, provided the operation that triggered this error was a getMore?

Examples:

Is the error resumable for the change stream?

error.change_stream_resumable?

Returns:

  • (true, false)

    Whether the error is resumable.

Since:

  • 2.6.0

[ GitHub ]

  
# File 'lib/mongo/error.rb', line 94

def change_stream_resumable?
  false
end

Instance Method Details

#write_concern_error_label?(label) ⇒ Boolean

Does the write concern error have the given label?

Parameters:

  • label (String)

    The label to check for the presence of.

Returns:

  • (Boolean)

    Whether the write concern error has the given label.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/error.rb', line 122

def write_concern_error_label?(label)
  @write_concern_error_labels.include?(label)
end

#write_concern_error_labelsArray<String>

The set of error labels associated with the write concern error.

Returns:

  • (Array<String>)

    The list of error labels.

Since:

  • 2.0.0

[ GitHub ]

  
# File 'lib/mongo/error.rb', line 129

def write_concern_error_labels
  @write_concern_error_labels.dup
end