This is the commit: v1::exception and v1::server_error (CXX-3237, CXX-3238) (#1501) · mongodb/mongo-cxx-driver@82f77b6 · GitHub
And looking at the code in question, it seems to be some kind of exception mapping:
template <typename exception_type>
[[noreturn]] void throw_exception(v1::exception const& ex) {
if (auto const ptr = dynamic_cast<v1::server_error const*>(&ex)) {
throw exception_type{
ptr->code(), bsoncxx::v_noabi::document::value{bsoncxx::v_noabi::from_v1(ptr->raw())}, ptr->what()};
}
throw exception_type{ex.code(), ex.what()};
}
Maybe the dynamic cast could be avoided by overloading with a v1::server_error parameter - if callers still have the full type info.
Also, just for my personal curiosity, why does this exception mapping happen in the first place?