Package com.mongodb
Class MongoUpdatedEncryptedFieldsException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.mongodb.MongoException
com.mongodb.MongoClientException
com.mongodb.MongoUpdatedEncryptedFieldsException
- All Implemented Interfaces:
Serializable
An exception thrown by methods that may automatically create data encryption keys
where needed based on the
encryptedFields
configuration.- Since:
- 4.9
- See Also:
-
Field Summary
Fields inherited from class com.mongodb.MongoException
TRANSIENT_TRANSACTION_ERROR_LABEL, UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL
-
Constructor Summary
ConstructorDescriptionMongoUpdatedEncryptedFieldsException
(BsonDocument encryptedFields, String msg, Throwable cause) Not part of the public API. -
Method Summary
Modifier and TypeMethodDescriptionTheencryptedFields
document that allows inferring which data keys are known to be created beforethis
exception happened by comparing this document with the originalencryptedFields
configuration.Methods inherited from class com.mongodb.MongoException
addLabel, addLabels, addLabels, fromThrowable, fromThrowableNonNull, getCode, getErrorLabels, hasErrorLabel, removeLabel
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
MongoUpdatedEncryptedFieldsException
public MongoUpdatedEncryptedFieldsException(BsonDocument encryptedFields, String msg, Throwable cause) Not part of the public API.- Parameters:
encryptedFields
- The (partially) updatedencryptedFields
document, which allows users to infer which data keys are known to be created before the exception happened (seegetEncryptedFields()
for more details). Reporting this back to a user may be helpful because creation of a data key includes persisting it in the key vault.msg
- The message.cause
- The cause.
-
-
Method Details
-
getEncryptedFields
TheencryptedFields
document that allows inferring which data keys are known to be created beforethis
exception happened by comparing this document with the originalencryptedFields
configuration. Creation of a data key includes persisting it in the key vault.Note that the returned
encryptedFields
document is not guaranteed to contain information about all the data keys that may be created, only about those that the driver is certain about. For example, if persisting a data key times out, the driver does not know whether it can be considered created or not, and does not include the information about the key in theencryptedFields
document. You can analyze whether the cause is a definite or indefinite error, and rely on the returnedencryptedFields
to be containing information on all created keys only if the error is definite.- Returns:
- The updated
encryptedFields
document.
-