Couchbase C++ SDK 1.4.0 (rev. 59aa900)
Loading...
Searching...
No Matches
error Class Reference

#include <couchbase/error.hxx>

Public Member Functions

 error ()=default
 error (std::error_code ec, std::string message={}, error_context ctx={})
 error (std::error_code ec, std::string message, error_context ctx, error cause)
 Constructs an error that wraps another error as its underlying cause.
 error (std::error_code ec, std::string message, error_context ctx, couchbase::node_id node_id)
 Constructs an error carrying the identity of the cluster node that returned it.
 error (std::error_code ec, std::string message, error_context ctx, error cause, couchbase::node_id node_id)
 Constructs an error that both wraps an underlying cause and carries the identity of the cluster node where the failure originated.
auto ec () const -> std::error_code
auto message () const -> const std::string &
auto ctx () const -> const error_context &
auto cause () const -> std::optional< error >
auto node_id () const -> const couchbase::node_id &
 Returns the identity of the cluster node where the error occurred.
 operator bool () const
auto operator== (const error &other) const -> bool

Constructor & Destructor Documentation

◆ error() [1/5]

error ( )
default

◆ error() [2/5]

error ( std::error_code ec,
std::string message = {},
error_context ctx = {} )

◆ error() [3/5]

error ( std::error_code ec,
std::string message,
error_context ctx,
error cause )

Constructs an error that wraps another error as its underlying cause.

Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ error() [4/5]

error ( std::error_code ec,
std::string message,
error_context ctx,
couchbase::node_id node_id )

Constructs an error carrying the identity of the cluster node that returned it.

Used by the KV path to attach the node_id from the session that handled the request.

Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ error() [5/5]

error ( std::error_code ec,
std::string message,
error_context ctx,
error cause,
couchbase::node_id node_id )

Constructs an error that both wraps an underlying cause and carries the identity of the cluster node where the failure originated.

Used when a higher-level path (e.g. transactions) wraps a KV failure — without this overload the outer error would silently lose node_id() attribution even though the inner cause()->node_id() is populated.

Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

Member Function Documentation

◆ cause()

auto cause ( ) const -> std::optional< error >
nodiscard

◆ ctx()

auto ctx ( ) const -> const error_context &
nodiscard

◆ ec()

auto ec ( ) const -> std::error_code
nodiscard

◆ message()

auto message ( ) const -> const std::string &
nodiscard

◆ node_id()

auto node_id ( ) const -> const couchbase::node_id &
nodiscard

Returns the identity of the cluster node where the error occurred.

The returned node_id is default-constructed (falsy) when the node could not be determined (e.g. for non-KV errors).

Returns
identity of the node that returned the error
Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ operator bool()

operator bool ( ) const
explicit

◆ operator==()

auto operator== ( const error & other) const -> bool

The documentation for this class was generated from the following file: