|
The spec says:
All errors from the MongoClient to mongocryptd MUST be distinguished in some way (e.g. exception type) to make it easier for users to distinguish when a command fails due to auto encryption limitations.
All errors from the MongoClient interacting with the key vault collection MUST be distinguished in some way (e.g. exception type) to make it easier for users to distinguish when a command fails due to behind-the-scenes operations required for encryption or decryption.
I think we may be able to automate this check in the spec tests by introducing a new result.errorClass field. For example:
- description: "$text unconditionally fails"
|
clientOptions:
|
autoEncryptOpts:
|
kmsProviders:
|
aws: {} # Credentials filled in from environment.
|
operations:
|
- name: find
|
arguments:
|
filter:
|
{ $text: { $search: "search text" } }
|
result:
|
errorContains: "Unsupported match expression operator for encryption"
|
errorClass: "MongocryptdError"
|
Some valid error classes may be: MongocryptdError, KeyVaultError, LibmongocryptError.
|