Exception: Mongo::Error::OperationFailure
- Inherits:
-
Mongo::Error
- Object
- StandardError
- Mongo::Error
- Mongo::Error::OperationFailure
- Defined in:
- lib/mongo/error/operation_failure.rb
Overview
Raised when an operation fails for some reason.
Constant Summary collapse
- RETRY_MESSAGES =
These are magic error messages that could indicate a cluster reconfiguration behind a mongos. We cannot check error codes as they change between versions, for example 15988 which has 2 completely different meanings between 2.4 and 3.0.
[ 'transport error', 'socket exception', "can't connect", 'no master', 'not master', 'could not contact primary', 'connect failed', 'error querying', 'could not get last error', 'connection attempt failed', 'interrupted at shutdown', 'unknown replica set', 'dbclient error communicating with server' ].freeze
Constants inherited from Mongo::Error
BAD_VALUE, CODE, CURSOR_NOT_FOUND, ERR, ERRMSG, ERROR, UNKNOWN_ERROR, WRITE_CONCERN_ERROR, WRITE_CONCERN_ERRORS, WRITE_ERRORS
Instance Method Summary collapse
-
#retryable? ⇒ true, false
Can the operation that caused the error be retried?.
Instance Method Details
#retryable? ⇒ true, false
Can the operation that caused the error be retried?
53 54 55 |
# File 'lib/mongo/error/operation_failure.rb', line 53 def retryable? RETRY_MESSAGES.any?{ |m| .include?(m) } end |