lib/mongo/crypt/status.rb in mongo-2.18.0.beta1 vs lib/mongo/crypt/status.rb in mongo-2.18.0
- old
+ new
@@ -116,13 +116,19 @@
# Raises a Mongo::Error:CryptError corresponding to the
# information stored in this status
#
# Does nothing if self.ok? is true
- def raise_crypt_error
+ #
+ # @param kms [ true | false ] Whether the operation was against the KMS.
+ #
+ # @note If kms parameter is false, the error may still have come from a
+ # KMS. The kms parameter simply forces all errors to be treated as
+ # KMS errors.
+ def raise_crypt_error(kms: false)
return if ok?
- if label == :error_kms
+ if kms || label == :error_kms
error = Error::KmsError.new(message, code: code)
else
error = Error::CryptError.new(message, code: code)
end