|
Driver wrappers that support exceptions won't need to return a state value for error, but instead throw an exception, ala
underylingState = state_function(...))
|
if (underlyingState == ERROR) {
|
throw ...
|
|
return WrappingEnum.fromUnderlyingState(underlyingState);
|
It may be simpler if state functions return a boolean to indicate error:
if (!state_function(...))) {
|
throw ...
|
|
underylingState = get_state ()
|
return WrappingEnum.fromUnderlyingState(underlyingState);
|
Concretely, that would mean changing:
mongocrypt_encryptor_state_t
|
mongocrypt_encryptor_add_ns (mongocrypt_encryptor_t *encryptor, const char *ns);
|
to
bool
|
mongocrypt_encryptor_add_ns (mongocrypt_encryptor_t *encryptor, const char *ns);
|
|