Exception: Mongo::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Mongo::Error
- Includes:
- Notable
- Defined in:
- build/ruby-driver-v2.17/lib/mongo/error.rb,
build/ruby-driver-v2.17/lib/mongo/error/parser.rb,
build/ruby-driver-v2.17/lib/mongo/error/notable.rb,
build/ruby-driver-v2.17/lib/mongo/error/kms_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/auth_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/lint_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/crypt_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_uri.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_file.rb,
build/ruby-driver-v2.17/lib/mongo/error/socket_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/closed_stream.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_nonce.rb,
build/ruby-driver-v2.17/lib/mongo/error/max_bson_size.rb,
build/ruby-driver-v2.17/lib/mongo/error/session_ended.rb,
build/ruby-driver-v2.17/lib/mongo/error/file_not_found.rb,
build/ruby-driver-v2.17/lib/mongo/error/no_srv_records.rb,
build/ruby-driver-v2.17/lib/mongo/error/handshake_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_address.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_session.rb,
build/ruby-driver-v2.17/lib/mongo/error/write_retryable.rb,
build/ruby-driver-v2.17/lib/mongo/error/bulk_write_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/extra_file_chunk.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_document.rb,
build/ruby-driver-v2.17/lib/mongo/error/max_message_size.rb,
build/ruby-driver-v2.17/lib/mongo/error/missing_password.rb,
build/ruby-driver-v2.17/lib/mongo/error/multi_index_drop.rb,
build/ruby-driver-v2.17/lib/mongo/error/unmet_dependency.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_signature.rb,
build/ruby-driver-v2.17/lib/mongo/error/mismatched_domain.rb,
build/ruby-driver-v2.17/lib/mongo/error/operation_failure.rb,
build/ruby-driver-v2.17/lib/mongo/error/pool_closed_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_txt_record.rb,
build/ruby-driver-v2.17/lib/mongo/error/missing_file_chunk.rb,
build/ruby-driver-v2.17/lib/mongo/error/missing_service_id.rb,
build/ruby-driver-v2.17/lib/mongo/error/unsupported_option.rb,
build/ruby-driver-v2.17/lib/mongo/error/connection_perished.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_read_option.rb,
build/ruby-driver-v2.17/lib/mongo/error/need_primary_server.rb,
build/ruby-driver-v2.17/lib/mongo/error/no_server_available.rb,
build/ruby-driver-v2.17/lib/mongo/error/server_api_conflict.rb,
build/ruby-driver-v2.17/lib/mongo/error/unexpected_response.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_read_concern.rb,
build/ruby-driver-v2.17/lib/mongo/error/missing_resume_token.rb,
build/ruby-driver-v2.17/lib/mongo/error/raise_original_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/sdam_error_detection.rb,
build/ruby-driver-v2.17/lib/mongo/error/socket_timeout_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/unknown_payload_type.rb,
build/ruby-driver-v2.17/lib/mongo/error/unsupported_features.rb,
build/ruby-driver-v2.17/lib/mongo/error/internal_driver_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_database_name.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_file_revision.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_min_pool_size.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_write_concern.rb,
build/ruby-driver-v2.17/lib/mongo/error/unsupported_collation.rb,
build/ruby-driver-v2.17/lib/mongo/error/credential_check_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_bulk_operation.rb,
build/ruby-driver-v2.17/lib/mongo/error/sessions_not_supported.rb,
build/ruby-driver-v2.17/lib/mongo/error/change_stream_resumable.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_collection_name.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_update_document.rb,
build/ruby-driver-v2.17/lib/mongo/error/mongocryptd_spawn_error.rb,
build/ruby-driver-v2.17/lib/mongo/error/unexpected_chunk_length.rb,
build/ruby-driver-v2.17/lib/mongo/error/bad_load_balancer_target.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_application_name.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_cursor_operation.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_server_auth_host.rb,
build/ruby-driver-v2.17/lib/mongo/error/server_api_not_supported.rb,
build/ruby-driver-v2.17/lib/mongo/error/unsupported_message_type.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_server_preference.rb,
build/ruby-driver-v2.17/lib/mongo/error/unsupported_array_filters.rb,
build/ruby-driver-v2.17/lib/mongo/error/server_certificate_revoked.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_bulk_operation_type.rb,
build/ruby-driver-v2.17/lib/mongo/error/connection_check_out_timeout.rb,
build/ruby-driver-v2.17/lib/mongo/error/insufficient_iteration_count.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_replacement_document.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_server_auth_response.rb,
build/ruby-driver-v2.17/lib/mongo/error/failed_string_prep_validation.rb,
build/ruby-driver-v2.17/lib/mongo/error/invalid_transaction_operation.rb,
build/ruby-driver-v2.17/lib/mongo/error/missing_scram_server_signature.rb,
build/ruby-driver-v2.17/lib/mongo/error/unchangeable_collection_option.rb,
build/ruby-driver-v2.17/lib/mongo/error/no_service_connection_available.rb,
build/ruby-driver-v2.17/lib/mongo/error/snapshot_session_invalid_server_version.rb,
build/ruby-driver-v2.17/lib/mongo/error/snapshot_session_transaction_prohibited.rb
Overview
Base error class for all Mongo related errors.
Direct Known Subclasses
BadLoadBalancerTarget, BulkWriteError, ClosedStream, ConnectionPerished, CryptError, ExtraFileChunk, FailedStringPrepValidation, FileNotFound, HandshakeError, InsufficientIterationCount, InternalDriverError, InvalidAddress, InvalidApplicationName, InvalidBulkOperation, InvalidBulkOperationType, InvalidCollectionName, InvalidCursorOperation, InvalidDatabaseName, InvalidDocument, InvalidFile, InvalidFileRevision, InvalidMinPoolSize, InvalidNonce, InvalidReadConcern, InvalidReadOption, InvalidReplacementDocument, InvalidServerPreference, InvalidSession, InvalidSignature, InvalidTXTRecord, InvalidTransactionOperation, InvalidURI, InvalidUpdateDocument, InvalidWriteConcern, LintError, MaxBSONSize, MaxMessageSize, MismatchedDomain, MissingFileChunk, MissingPassword, MissingResumeToken, MissingScramServerSignature, MissingServiceId, MultiIndexDrop, NeedPrimaryServer, NoSRVRecords, NoServerAvailable, NoServiceConnectionAvailable, OperationFailure, PoolClosedError, ServerApiConflict, ServerApiNotSupported, ServerCertificateRevoked, SessionEnded, SnapshotSessionInvalidServerVersion, SnapshotSessionTransactionProhibited, SocketError, SocketTimeoutError, UnchangeableCollectionOption, UnexpectedChunkLength, UnexpectedResponse, UnknownPayloadType, UnmetDependency, UnsupportedFeatures, UnsupportedMessageType, UnsupportedOption
Defined Under Namespace
Modules: ChangeStreamResumable, Notable, SdamErrorDetection, WriteRetryable Classes: AuthError, BadLoadBalancerTarget, BulkWriteError, ClosedStream, ConnectionCheckOutTimeout, ConnectionPerished, CredentialCheckError, CryptError, ExtraFileChunk, FailedStringPrepValidation, FileNotFound, HandshakeError, InsufficientIterationCount, InternalDriverError, InvalidAddress, InvalidApplicationName, InvalidBulkOperation, InvalidBulkOperationType, InvalidCollectionName, InvalidCursorOperation, InvalidDatabaseName, InvalidDocument, InvalidFile, InvalidFileRevision, InvalidMinPoolSize, InvalidNonce, InvalidReadConcern, InvalidReadOption, InvalidReplacementDocument, InvalidServerAuthHost, InvalidServerAuthResponse, InvalidServerPreference, InvalidSession, InvalidSignature, InvalidTXTRecord, InvalidTransactionOperation, InvalidURI, InvalidUpdateDocument, InvalidWriteConcern, KmsError, LintError, MaxBSONSize, MaxMessageSize, MismatchedDomain, MissingFileChunk, MissingPassword, MissingResumeToken, MissingScramServerSignature, MissingServiceId, MongocryptdSpawnError, MultiIndexDrop, NeedPrimaryServer, NoSRVRecords, NoServerAvailable, NoServiceConnectionAvailable, OperationFailure, Parser, PoolClosedError, RaiseOriginalError, ServerApiConflict, ServerApiNotSupported, ServerCertificateRevoked, SessionEnded, SessionsNotSupported, SnapshotSessionInvalidServerVersion, SnapshotSessionTransactionProhibited, SocketError, SocketTimeoutError, UnchangeableCollectionOption, UnexpectedChunkLength, UnexpectedResponse, UnknownPayloadType, UnmetDependency, UnsupportedArrayFilters, UnsupportedCollation, UnsupportedFeatures, UnsupportedMessageType, UnsupportedOption
Constant Summary collapse
- CODE =
The error code field.
'code'.freeze
- ERR =
Deprecated.
An error field, MongoDB < 2.6
'$err'.freeze
- ERROR =
Deprecated.
An error field, MongoDB < 2.4
'err'.freeze
- ERRMSG =
Deprecated.
The standard error message field, MongoDB 3.0+
'errmsg'.freeze
- WRITE_ERRORS =
Deprecated.
The constant for the writeErrors array.
'writeErrors'.freeze
- WRITE_CONCERN_ERROR =
Deprecated.
The constant for a write concern error.
'writeConcernError'.freeze
- WRITE_CONCERN_ERRORS =
Deprecated.
The constant for write concern errors.
'writeConcernErrors'.freeze
- UNKNOWN_ERROR =
Constant for an unknown error.
8.freeze
- BAD_VALUE =
Constant for a bad value error.
2.freeze
- CURSOR_NOT_FOUND =
Constant for a Cursor not found error.
'Cursor not found.'
- UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL =
Deprecated.
Error label describing commitTransaction errors that may or may not occur again if a commit is manually retried by the user.
'UnknownTransactionCommitResult'.freeze
- TRANSIENT_TRANSACTION_ERROR_LABEL =
Deprecated.
Error label describing errors that will likely not occur if a transaction is manually retried from the start.
'TransientTransactionError'.freeze
Instance Attribute Summary
Attributes included from Notable
Instance Method Summary collapse
-
#add_label(label) ⇒ Object
private
Adds the specified label to the error instance, if the label is not already in the set of labels.
-
#change_stream_resumable? ⇒ true, false
Can the change stream on which this error occurred be resumed, provided the operation that triggered this error was a getMore?.
-
#initialize(msg = nil) ⇒ Error
constructor
A new instance of Error.
-
#label?(label) ⇒ true, false
Does the error have the given label?.
-
#labels ⇒ Array
Gets the set of labels associated with the error.
-
#write_concern_error_label?(label) ⇒ Boolean
Does the write concern error have the given label?.
-
#write_concern_error_labels ⇒ Array<String>
The set of error labels associated with the write concern error.
Methods included from Notable
Constructor Details
#initialize(msg = nil) ⇒ Error
Returns a new instance of Error.
110 111 112 113 114 |
# File 'build/ruby-driver-v2.17/lib/mongo/error.rb', line 110 def initialize(msg = nil) super @labels = [] @write_concern_error_labels = [] end |
Instance Method Details
#add_label(label) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds the specified label to the error instance, if the label is not already in the set of labels.
164 165 166 |
# File 'build/ruby-driver-v2.17/lib/mongo/error.rb', line 164 def add_label(label) @labels << label unless label?(label) end |
#change_stream_resumable? ⇒ true, false
Can the change stream on which this error occurred be resumed, provided the operation that triggered this error was a getMore?
92 93 94 |
# File 'build/ruby-driver-v2.17/lib/mongo/error.rb', line 92 def change_stream_resumable? false end |
#label?(label) ⇒ true, false
Does the error have the given label?
126 127 128 |
# File 'build/ruby-driver-v2.17/lib/mongo/error.rb', line 126 def label?(label) @labels.include?(label) end |
#labels ⇒ Array
Gets the set of labels associated with the error.
147 148 149 |
# File 'build/ruby-driver-v2.17/lib/mongo/error.rb', line 147 def labels @labels.dup end |
#write_concern_error_label?(label) ⇒ Boolean
Does the write concern error have the given label?
135 136 137 |
# File 'build/ruby-driver-v2.17/lib/mongo/error.rb', line 135 def write_concern_error_label?(label) @write_concern_error_labels.include?(label) end |
#write_concern_error_labels ⇒ Array<String>
The set of error labels associated with the write concern error.
154 155 156 |
# File 'build/ruby-driver-v2.17/lib/mongo/error.rb', line 154 def write_concern_error_labels @write_concern_error_labels.dup end |