17#include <bsoncxx/document/value.hpp>
18#include <mongocxx/exception/server_error_code.hpp>
19#include <mongocxx/private/libmongoc.hpp>
21#include <mongocxx/config/private/prelude.hpp>
24MONGOCXX_INLINE_NAMESPACE_BEGIN
26inline std::error_code make_error_code(
int code,
int) {
28 return {code, server_error_category()};
31inline std::error_code make_error_code(::bson_error_t error) {
32 return make_error_code(error.code, error.domain);
35template <
typename exception_type>
36void throw_exception(::bson_error_t error) {
37 throw exception_type{make_error_code(error), error.message};
40template <
typename exception_type>
42 throw exception_type{make_error_code(error), std::move(raw_server_error), error.message};
45MONGOCXX_INLINE_NAMESPACE_END
48#include <mongocxx/config/private/postlude.hpp>
A read-only BSON document that owns its underlying buffer.
Definition value.hpp:33