Method: Mongo::Crypt::Status#raise_crypt_error

Defined in:
lib/mongo/crypt/status.rb

#raise_crypt_error(kms: false) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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.

Raises a Mongo::Error:CryptError corresponding to the information stored in this status

Does nothing if self.ok? is true

Parameters:

  • kms (true | false) (defaults to: false)

    Whether the operation was against the KMS.



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/mongo/crypt/status.rb', line 127

def raise_crypt_error(kms: false)
  return if ok?

  if kms || label == :error_kms
    error = Error::KmsError.new(message, code: code)
  else
    error = Error::CryptError.new(message, code: code)
  end

  raise error
end