Exception: Mongo::Error
Overview
Base error class for all ::Mongo
related errors.
Constant Summary
-
BAD_VALUE =
Constant for a bad value error.
2.freeze
-
CODE =
The error code field.
'code'.freeze
-
CURSOR_NOT_FOUND =
Constant for a
Cursor
not found error.'Cursor not found.'
-
ERR =
Deprecated.
An error field, MongoDB < 2.6
'$err'.freeze
-
ERRMSG =
Deprecated.
The standard error message field, MongoDB 3.0+
'errmsg'.freeze
-
ERROR =
Deprecated.
An error field, MongoDB < 2.4
'err'.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
-
UNKNOWN_ERROR =
Constant for an unknown error.
8.freeze
-
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
-
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
-
WRITE_ERRORS =
Deprecated.
The constant for the writeErrors array.
'writeErrors'.freeze
Class Method Summary
- .new(msg = nil) ⇒ Error constructor
Instance Attribute Summary
-
#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?
- #network_error? ⇒ true, false readonly
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
-
#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.
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
# 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?
# File 'lib/mongo/error.rb', line 94
def change_stream_resumable? false end
#network_error? ⇒ true
, false
(readonly)
# File 'lib/mongo/error/kms_error.rb', line 30
def network_error? @network_error == true end
Instance Method Details
#write_concern_error_label?(label) ⇒ Boolean
Does the write concern error have the given label?
# File 'lib/mongo/error.rb', line 122
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.
# File 'lib/mongo/error.rb', line 129
def write_concern_error_labels @write_concern_error_labels.dup end