bson_iter_init_find() and bson_iter_init_find_case() are currently documented to return false in either of the following two circumstances:
- Iterator initialization fails.
- The iterator was successfully exhausted and the requested key was not found.
Because of this ambiguity, it is not currently clear whether or not a consumer of this API should propagate an error up the call stack when it receives a false return value from one of these two functions.
Instead, these API functions should BSON_ASSERT() that iterator initialization was successful, and their documentation should be updated to reflect that they will never return an error.
See also my comment at CXX-1066 for further discussion.
- is related to
-
CXX-1066 Audit all libmongoc and libbson calls for error handling
- Closed