Exceção: Mongo::Error

Herda:
StandardError
  • Objeto
mostrar tudo
Inclui:
ChangeStreamResumable, Labelable, Notável, WriteRetryable
Definido em:
build/ruby-driver-v2.19/lib/mongo/error.rb,
build/ruby-driver-v2.19/lib/mongo/error/parser.rb,
build/ruby-driver-v2.19/lib/mongo/error/notable.rb,
build/ruby-driver-v2.19/lib/mongo/error/kms_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/labelable.rb,
build/ruby-driver-v2.19/lib/mongo/error/auth_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/lint_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/pool_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/crypt_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_uri.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_file.rb,
build/ruby-driver-v2.19/lib/mongo/error/socket_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/client_closed.rb,
build/ruby-driver-v2.19/lib/mongo/error/closed_stream.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_nonce.rb,
build/ruby-driver-v2.19/lib/mongo/error/max_bson_size.rb,
build/ruby-driver-v2.19/lib/mongo/error/session_ended.rb,
build/ruby-driver-v2.19/lib/mongo/error/file_not_Found.rb,
build/ruby-driver-v2.19/lib/mongo/error/no_srv_records.rb,
build/ruby-driver-v2.19/lib/mongo/error/handshake_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_address.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_session.rb,
build/ruby-driver-v2.19/lib/mongo/error/write_retryable.rb,
build/ruby-driver-v2.19/lib/mongo/error/bulk_write_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/extra_file_chunk.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_document.rb,
build/ruby-driver-v2.19/lib/mongo/error/max_message_size.rb,
build/ruby-driver-v2.19/lib/mongo/error/missing_password.rb,
build/ruby-driver-v2.19/lib/mongo/error/multi_index_drop.rb,
build/ruby-driver-v2.19/lib/mongo/error/unmet_dependency.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_signature.rb,
build/ruby-driver-v2.19/lib/mongo/error/mismatched_domain.rb,
build/ruby-driver-v2.19/lib/mongo/error/operation_failure.rb,
build/ruby-driver-v2.19/lib/mongo/error/pool_closed_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/pool_paused_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/server_not_usable.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_txt_record.rb,
build/ruby-driver-v2.19/lib/mongo/error/missing_connection.rb,
build/ruby-driver-v2.19/lib/mongo/error/missing_file_chunk.rb,
build/ruby-driver-v2.19/lib/mongo/error/missing_service_id.rb,
build/ruby-driver-v2.19/lib/mongo/error/pool_cleared_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/unsupported_option.rb,
build/ruby-driver-v2.19/lib/mongo/error/connection_perished.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_read_option.rb,
build/ruby-driver-v2.19/lib/mongo/error/need_primary_server.rb,
build/ruby-driver-v2.19/lib/mongo/error/no_server_available.rb,
build/ruby-driver-v2.19/lib/mongo/error/server_api_conflict.rb,
build/ruby-driver-v2.19/lib/mongo/error/unexpected_response.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_read_concern.rb,
build/ruby-driver-v2.19/lib/mongo/error/missing_resume_token.rb,
build/ruby-driver-v2.19/lib/mongo/error/raise_ original_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/read_write_retryable.rb,
build/ruby-driver-v2.19/lib/mongo/error/sdam_error_ detection.rb,
build/ruby-driver-v2.19/lib/mongo/error/socket_timeout_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/unknown_playload_type.rb,
build/ruby-driver-v2.19/lib/mongo/error/unsupported_features.rb,
build/ruby-driver-v2.19/lib/mongo/error/internal_driver_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_config_option.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_database_name.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_file_revision.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_min_pool_size.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_write_concern.rb,
build/ruby-driver-v2.19/lib/mongo/error/unsupported_collation.rb,
build/ruby-driver-v2.19/lib/mongo/error/connection_unavailable.rb,
build/ruby-driver-v2.19/lib/mongo/error/credential_check_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_bulk_operation.rb,
build/ruby-driver-v2.19/lib/mongo/error/sessions_not_supported.rb,
build/ruby-driver-v2.19/lib/mongo/error/change_stream_resumable.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_collection_name.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_update_document.rb,
build/ruby-driver-v2.19/lib/mongo/error/mongocryptd_spawn_error.rb,
build/ruby-driver-v2.19/lib/mongo/error/unexpected_chunk_long.rb,
build/ruby-driver-v2.19/lib/mongo/error/bad_load_balancer_target.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_application_name.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_cursor_operation.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_server_auth_host.rb,
build/ruby-driver-v2.19/lib/mongo/error/server_api_not_supported.rb,
build/ruby-driver-v2.19/lib/mongo/error/session_not_materialized.rb,
build/ruby-driver-v2.19/lib/mongo/error/unsupported_message_type.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_server_preference.rb,
build/ruby-driver-v2.19/lib/mongo/error/unsupported_array_filters.rb,
build/ruby-driver-v2.19/lib/mongo/error/server_certificate_revoned.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_bulk_operation_type.rb,
build/ruby-driver-v2.19/lib/mongo/error/connection_check_out_timeout.rb,
build/ruby-driver-v2.19/lib/mongo/error/insufeficiente_iteration_count.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_replacement_document.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_server_auth_response.rb,
build/ruby-driver-v2.19/lib/mongo/error/failed_string_prep_validation.rb,
build/ruby-driver-v2.19/lib/mongo/error/invalid_transaction_operation.rb,
build/ruby-driver-v2.19/lib/mongo/error/missing_scram_server_signature.rb,
build/ruby-driver-v2.19/lib/mongo/error/unchangeable_collection_option.rb,
build/ruby-driver-v2.19/lib/mongo/error/no_service_connection_available.rb,
build/ruby-driver-v2.19/lib/mongo/error/snapshot_session_invalid_server_version.rb,
build/ruby-driver-v2.19/lib/mongo/error/snapshot_session_transaction_prohibited.rb

Visão geral

Classe de erro base para todos os erros relacionados ao mongo .

Desde:

  • 2.0.0

Subclasses conhecidas diretas

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::MissingVariable, Servidor::AppMetadata::Environment::TooManyEnvironments, Servidor::AppMetadata::Environment::TypeMismatch, Servidor::AppMetadata::Environment::ValueTooLong

Definido sob namespace

Módulos: 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

Colapsode resumo constante

COD =

O campo de código de erro.

Desde:

  • 2.0.0

'código'.congelar
ERR =
Obsoleto.

Um campo de erro, MongoDB < 2.6

Desde:

  • 2.0.0

'$err'.congelar
ERRO =
Obsoleto.

Um campo de erro, MongoDB < 2.4

Desde:

  • 2.0.0

'err'.congelar
ERRMSG =
Obsoleto.

O campo de mensagem de erro padrão, MongoDB 3.0+

Desde:

  • 2.0.0

'errmsg'.congelar
WRITE_ERRORS =
Obsoleto.

A constante da array writeErrors.

Desde:

  • 2.0.0

'writeErrors'.congelar
WRITE_CONCERN_ERROR =
Obsoleto.

A constante para um erro de preocupação de gravação .

Desde:

  • 2.0.0

'writeConcernError'.congelar
WRITE_CONCERN_ERRORS =
Obsoleto.

A constante para erros de write concern.

Desde:

  • 2.1.0

'writeConcernErrors'.congelar
UNKNOWN_ERROR =

Constante para um erro desconhecido.

Desde:

  • 2.0.0

8.congelar
BAD_VALUE =

Constante para um erro de valor incorreto.

Desde:

  • 2.0.0

2.congelar
CURSOR_NOT_FOUND =

Constante para um erro de cursor não encontrado.

Desde:

  • 2.2.3

'Cursor não encontrado.'
UNKNOWN_TRANSACTION_COMMIT_RESULT_LAbel =
Obsoleto.

Etiqueta de erro descrevendo erros de commitTransaction que podem ou não ocorrer novamente se um commit for manualmente repetido pelo usuário.

Desde:

  • 2.6.0

'UnknownTransactionCommitResult'.congelar
TRANSIENT_TRANSACTION_ERROR_LABEL =
Obsoleto.

Etiqueta de erro que descreve erros que provavelmente não ocorrerão se uma transação for repetida manualmente desde o início.

Desde:

  • 2.6.0

'TransientTransactionError'.congelar

Resumo do atributo de instância

Atributos incluídos de Notável

#connection_global_id, # generação, #service_id

Recolhimento do Resumo do método de instância

Métodos incluídos do WriteRetryable

#write_retryable?

Métodos incluídos do Labelable

#add_label, #label?, #labels

Métodos incluídos do Notable

#add_note, #add_notes, #notes, #to_s

Detalhes do construtor

#initialize(msg = nil) ➤ Erro

Retorna uma nova instância de Error.

Desde:

  • 2.0.0



112
113
114
115
# File 'build/ruby-driver-v2.19/lib/mongo/error.rb', linha 112

def inicializar(mensagem = nada)
  super
  @write_concern_error_labels = []
end

Detalhes do método de instância

#change_stream_resumable?true, false

O change stream no qual ocorreu esse erro pode ser retomado, desde que a operação que acionou esse erro tenha sido um getMore?

Exemplos:

O erro é retomável para o fluxo de alterações?

error.change_stream_resumable?

Retorna:

  • (verdadeiro, falso)

    Se o erro é retomável.

Desde:

  • 2.6.0



94
95
96
# File 'build/ruby-driver-v2.19/lib/mongo/error.rb', linha 94

def change_stream_resumable?
  false
end

#write_concern_error_label?(label) ➤ Booleano

O erro de write concern tem o rótulo fornecido?

Parâmetros:

  • etiqueta (string)

    O rótulo para verificar a presença.

Retorna:

  • (Booleano)

    Se o erro de preocupação de gravação tem o rótulo fornecido.

Desde:

  • 2.0.0



122
123
124
# File 'build/ruby-driver-v2.19/lib/mongo/error.rb', linha 122

def write_concern_error_label?(etiqueta)
  @write_concern_error_labels.incluir?(etiqueta)
end

#write_concern_error_labels ➤ Array<String>

O conjunto de rótulos de erro associados ao erro de preocupação de gravação .

Retorna:

  • (Array<String>)

    A lista de rótulos de erro.

Desde:

  • 2.0.0



129
130
131
# File 'build/ruby-driver-v2.19/lib/mongo/error.rb', linha 129

def write_concern_error_labels
  @write_concern_error_labels.dup
end