异常:Mongo::Error

继承:
StandardError
  • 对象
显示全部
包括:
ChangeStreamResumableLabelableNotableWriteRetryable
定义于:
build/Ruby-driver-v 2.19 /lib/mongo/error.rb ,
build/Ruby-driver-v 2.19 /lib/mongo/error/parser.rb,
build/Ruby-driver-v 2.19 /lib/mongo/error/notable.rb,
build/Ruby-driver-v 2.19 /lib/mongo/error/kms_error.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/labelable.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/auth_error.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/lint_error.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/pool_error.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/crypt_error.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_uri.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_file.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/socket_error.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/client_close.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/losed_stream.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/invalid_nonce.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/max_bson_size.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/session_ended.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/file_not_Found.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/no_srv_records.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/handshake_error.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_address.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/invalid_session.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/write_retryable.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/bulk_write_error.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/extra_file_chunk.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/invalid_document.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/max_message_size.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/missing_password.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/multi_index_drop.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/unmet_dependency.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_signature.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/mismatched_domain.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/operation_failure.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/pool_close_error.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/pool_paused_error.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/server_not_usable.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/invalid_txt_record.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/missing_connection.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/missing_file_chunk.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/missing_service_id.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/pool_cleared_error.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/unsupported_option.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/connection_perished.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_read_option.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/need_primary_server.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/no_server_available.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/server_api_conflict.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/unexpected_response.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/invalid_read_concern.rb,
build/Ruby-driver-v 2 。 19 /lib/mongo/error/missing_resume_token.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/rise_original_error.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/read_write_retryable.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/sdam_error_decion.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/socket_timeout_error.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/unknown_payload_type.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/unsupported_features.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/internal_driver_error.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_config_option.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_database_name.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_file_revision.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_min_pool_size.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_write_concern.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/unsupported_collation.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/connection_unavailable.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/credential_check_error.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_bulk_operation.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/sessions_not_supported.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/change_stream_resumable.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_collection_name.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_update_document.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/mongocryptd_spawn_error.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/unexpected_chunk_length.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/bad_load_balancer_target.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_application_name.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_cursor_operation.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_server_auth_host.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/server_api_not_supported.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/session_not_materialized.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/unsupported_message_type.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_server_preference.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/unsupported_array_filters.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/server_certificate_revoked.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_bulk_operation_type.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/connection_check_out_timeout.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/insufficient_iteration_count.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_replacement_document.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_server_auth_response.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/failed_string_prep_validation.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/invalid_transaction_operation.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/missing_scram_server_signature.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/unchangeable_collection_option.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/no_service_connection_available.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/snapshot_session_invalid_server_version.rb,
build/Ruby-driver-v 2 . 19 /lib/mongo/error/snapshot_session_transaction_prohibited.rb

Overview

所有mongo相关错误的基本错误类。

由于:

  • 2.0.0

直接已知子类

BadLoadBalancerTarget , BulkWriteError , ClientClosed , ClosedStream , ConnectionPerished , ConnectionUnavailable , CryptError , ExtraFileChunk , FailedStringPrepValidation , FileNotFound , HandshakeError , InsufficientIterationCount , InternalDriverError , InvalidAddress , InvalidApplicationName , InvalidBulkOperation , InvalidBulkOperationType , InvalidCollectionName , InvalidConfigOption , InvalidCursorOperation , InvalidDatabaseName , InvalidDocument , InvalidFile , InvalidFileRevision , InvalidMinPoolSize , InvalidNonce , InvalidReadConcern , InvalidReadOption , InvalidReplacementDocument , InvalidServerPreference , InvalidSession , InvalidSignature , InvalidTXTRecord , InvalidTransactionOperation , InvalidURI , InvalidUpdateDocument , InvalidWriteConcern , LintError , MaxBSONSize , MaxMessageSize , MismatchedDomain , MissingConnection , MissingFileChunk , MissingPassword , MissingResumeToken , MissingScramServerSignature , MissingServiceId , MultiIndexDrop , NeedPrimaryServer , N oSRVRecords , NoServerAvailable , NoServiceConnectionAvailable , OperationFailure , PoolError , ServerApiConflict , ServerApiNotSupported , ServerCertificateRevoked , ServerNotUsable , SessionEnded , SnapshotSessionInvalidServerVersion , SnapshotSessionTransactionProhibited , SocketError , SocketTimeoutError , UnchangeableCollectionOption , UnexpectedChunkLength , UnexpectedResponse , UnknownPayloadType , UnmetDependency , UnsupportedFeatures , UnsupportedMessageType , UnsupportedOption , Server::AppMetadata:: Environment::MissingVariableServer::AppMetadata::Environment::TooManyEnvironmentsServer::AppMetadata::Environment::TypeMismatchServer::AppMetadata::Environment::ValueTooLong

在命名空间下定义

模块: ChangeStreamResumable, Labelable, Notable, ReadWriteRetryable, SdamErrorDetection, WriteRetryable Classes: AuthError, BadLoadBalancerTarget, BulkWriteError, ClientClosed, ClosedStream, ConnectionCheckOutTimeout, ConnectionPerished, ConnectionUnavailable, CredentialCheckError, CryptError, ExtraFileChunk, FailedStringPrepValidation, FileNotFound, HandshakeError, InsufficientIterationCount, InternalDriverError, InvalidAddress, InvalidApplicationName, InvalidBulkOperation, InvalidBulkOperationType, InvalidCollectionName, InvalidConfigOption, 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, MissingConnection, MissingFileChunk, MissingPassword, MissingResumeToken, MissingScramServerSignature, MissingServiceId, MongocryptdSpawnError, MultiIndexDrop, NeedPrimaryServer, NoSRVRecords, NoServerAvailable, NoServiceConnectionAvailable, OperationFailure, Parser, PoolClearedError, PoolClosedError, PoolError, PoolPausedError, RaiseOriginalError, ServerApiConflict, ServerApiNotSupported, ServerCertificateRevoked, ServerNotUsable, SessionEnded, SessionNotMaterialized, SessionsNotSupported, SnapshotSessionInvalidServerVersion, SnapshotSessionTransactionProhibited, SocketError, SocketTimeoutError, UnchangeableCollectionOption, UnexpectedChunkLength, UnexpectedResponse, UnknownPayloadType, UnmetDependency, UnsupportedArrayFilters, UnsupportedCollation, UnsupportedFeatures, UnsupportedMessageType, UnsupportedOption

常量摘要折叠

代码 =

错误代码字段。

由于:

  • 2.0.0

' code '.冻结
ERR =
已弃用。

错误字段,MongoDB < 2.6

由于:

  • 2.0.0

'$err'.冻结
错误 =
已弃用。

错误字段,MongoDB < 2.4

由于:

  • 2.0.0

'err'.冻结
ERRMSG =
已弃用。

标准错误消息字段,MongoDB 3.0 +

由于:

  • 2.0.0

'errmsg'.冻结
WRITE_ERRORS =
已弃用。

writeErrors 数组的常量。

由于:

  • 2.0.0

' writeErrors '.冻结
WRITE_CONCERN_ERROR =
已弃用。

写关注(write concern)错误常量。

由于:

  • 2.0.0

' writeConcernError '.冻结
WRITE_CONCERN_ERRORS =
已弃用。

写关注错误常量。

由于:

  • 2.1.0

' writeConcernErrors '.冻结
UNKNOWN_ERROR =

表示未知错误的常量。

由于:

  • 2.0.0

8.冻结
BAD_VALUE =

表示错误值的常量。

由于:

  • 2.0.0

2.冻结
CURSOR_NOT_FOUND =

未找到游标错误的常量。

由于:

  • 2.2.3

'未找到游标。'
UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL =
已弃用。

描述 commitTransaction 错误的错误标签,如果用户手动重试提交,这些错误可能会也可能不会再次发生。

由于:

  • 2.6.0

' UnknownTransactionCommitResult '.冻结
TRANSIENT_TRANSACTION_ERROR_LABEL =
已弃用。

错误标签描述了如果从一开始就手动重试事务,则可能不会发生的错误。

由于:

  • 2.6.0

'TransientTransactionError'.冻结

实例属性摘要

包含在Notable中的属性

#connection_global_id#Generation#service_id

实例方法摘要折叠

WriteRetryable 中包含的方法

#write_retryable?

Labelable 中包含的方法

#add_label , #label? , #labels

Notable中包含的方法

#add_note#add_notes#notes#to_s

构造函数详情

#initialize (msg = nil) ⇒错误

返回 Error 的新实例。

由于:

  • 2.0.0



112
113
114
115
# File 'build/Ruby-driver-v 2.19 /lib/mongo/error.rb', line 112

def 初始化(msg = nil)
  
  @write_concern_error_labels = []
end

实例方法详细信息

# change_stream_resumable?true , false

如果触发此错误的操作是 getMore,是否可以恢复发生此错误的变更流?

例子:

变更流的错误是否可恢复?

error.change_stream_resumable?

返回:

  • ( true , false )

    错误是否可恢复。

由于:

  • 2.6.0



94
95
96
# File 'build/Ruby-driver-v 2.19 /lib/mongo/error.rb', line 94

def change_stream_resumable?
  false
end

# write_concern_error_label? (标签)→布尔值

写关注错误是否具有给定标签?

参数:

  • 标签 ( string )

    要检查其是否存在的标签。

返回:

  • ( Boolean )

    写关注(write concern)错误是否具有给定标签。

由于:

  • 2.0.0



122
123
124
# File 'build/Ruby-driver-v 2.19 /lib/mongo/error.rb', line 122

def write_concern_error_label?(标签)
  @write_concern_error_labels.包括?(标签)
end

# write_concern_error_labelsArray<String>

与写关注(write concern)错误关联的错误标签设立。

返回:

  • ( Array<String> )

    错误标签列表。

由于:

  • 2.0.0



129
130
131
# File 'build/Ruby-driver-v 2.19 /lib/mongo/error.rb', line 129

def write_concern_error_labels
  @write_concern_error_labels.dup
end