Loading...
Searching...
No Matches
operation_exception.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <string>
#include <mongocxx/exception/operation_exception-fwd.hpp> // IWYU pragma: export
#include <bsoncxx/document/value.hpp>
#include <bsoncxx/stdx/optional.hpp>
#include <mongocxx/exception/exception.hpp>
#include <bsoncxx/config/prelude.hpp>
#include <mongocxx/config/prelude.hpp>
namespace mongocxx {
namespace v_noabi {
BSONCXX_PRIVATE_WARNINGS_PUSH();
BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4251));
BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4275));
class operation_exception : public exception {
public:
~operation_exception() override;
operation_exception(operation_exception&&) = default;
operation_exception& operator=(operation_exception&&) = default;
operation_exception(operation_exception const&) = default;
operation_exception& operator=(operation_exception const&) = default;
using exception::exception;
operation_exception(
std::error_code ec,
bsoncxx::v_noabi::document::value&& raw_server_error,
std::string what_arg = "");
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value> const& raw_server_error() const;
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value>& raw_server_error();
bool has_error_label(bsoncxx::v_noabi::stdx::string_view label) const;
private:
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value> _raw_server_error;
};
BSONCXX_PRIVATE_WARNINGS_POP();
} // namespace v_noabi
} // namespace mongocxx
#include <bsoncxx/config/postlude.hpp>
#include <mongocxx/config/postlude.hpp>
postlude.hpp
The bsoncxx v_noabi macro guard postlude header.
prelude.hpp
The bsoncxx v_noabi macro guard prelude header.
bsoncxx::v1::stdx::optional
A polyfill for std::optional<T>.
Definition optional.hpp:799
bsoncxx::v1::stdx::string_view
A polyfill for std::string_view.
Definition string_view.hpp:412
bsoncxx::v_noabi::document::value
A read-only BSON document that owns its underlying buffer.
Definition value.hpp:48
mongocxx::v_noabi::operation_exception::operation_exception
operation_exception(std::error_code ec, bsoncxx::v_noabi::document::value &&raw_server_error, std::string what_arg="")
Constructs a new operation exception.
mongocxx::v_noabi::operation_exception::has_error_label
bool has_error_label(bsoncxx::v_noabi::stdx::string_view label) const
Checks for the specified label in a operation exception.
mongocxx::v_noabi::operation_exception::raw_server_error
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::value > & raw_server_error()
The optional raw bson error document from the server.
mongocxx::v_noabi::operation_exception::raw_server_error
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::value > const & raw_server_error() const
The optional raw bson error document from the server.
postlude.hpp
The mongocxx v_noabi macro guard postlude header.
prelude.hpp
The mongocxx v_noabi macro guard prelude header.
exception.hpp
Provides mongocxx::v_noabi::exception.
mongocxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
operation_exception-fwd.hpp
Declares mongocxx::v_noabi::operation_exception.
value.hpp
Provides bsoncxx::v_noabi::document::value.
optional.hpp
Provides std::optional-related polyfills for library API usage.