6 #include <zookeeper/zookeeper.h>
15 std::ostream& operator<<(std::ostream& os,
const error_code& code)
20 default:
return os <<
"error_code(" <<
static_cast<int>(code) <<
')';
26 std::ostringstream os;
54 default:
throw error(code,
"unknown");
66 return std::current_exception();
77 virtual ptr<const char> name()
const noexcept
override {
return "zookeeper"; }
79 virtual std::string message(
int condition)
const override;
82 std::string error_category_impl::message(
int condition)
const
84 return to_string(static_cast<error_code>(condition));
97 static std::string format_error(
error_code code,
const std::string& description)
99 if (description.empty())
100 return to_string(code);
102 return to_string(code) +
": " + description;
105 error::error(
error_code code,
const std::string& description) :
106 std::system_error(static_cast<int>(code),
error_category(), format_error(code, description)),
110 error::~error() noexcept = default;
112 transport_error::transport_error(
error_code code, const std::
string& description) :
113 error(code, std::move(description))
116 transport_error::~transport_error() noexcept = default;
118 connection_loss::connection_loss() :
119 transport_error(
error_code::connection_loss, "")
122 connection_loss::~connection_loss() noexcept = default;
124 marshalling_error::marshalling_error() :
125 transport_error(
error_code::marshalling_error, "")
128 marshalling_error::~marshalling_error() noexcept = default;
134 not_implemented::~not_implemented() noexcept = default;
137 error(code, description)
140 invalid_arguments::invalid_arguments() :
141 invalid_arguments(
error_code::invalid_arguments,
"")
144 invalid_arguments::~invalid_arguments() noexcept = default;
150 authentication_failed::~authentication_failed() noexcept = default;
152 invalid_ensemble_state::invalid_ensemble_state(
error_code code, const std::
string& description) :
153 error(code, description)
156 invalid_ensemble_state::~invalid_ensemble_state() noexcept = default;
162 new_configuration_no_quorum::~new_configuration_no_quorum() noexcept = default;
168 reconfiguration_in_progress::~reconfiguration_in_progress() noexcept = default;
174 reconfiguration_disabled::~reconfiguration_disabled() noexcept = default;
176 invalid_connection_state::invalid_connection_state(
error_code code, const std::
string& description) :
177 error(code, description)
180 invalid_connection_state::~invalid_connection_state() noexcept = default;
186 session_expired::~session_expired() noexcept = default;
192 not_authorized::~not_authorized() noexcept = default;
198 closed::~closed() noexcept = default;
204 ephemeral_on_local_session::~ephemeral_on_local_session() noexcept = default;
210 read_only_connection::~read_only_connection() noexcept = default;
212 check_failed::check_failed(
error_code code, const std::
string& description) :
213 error(code, description)
216 check_failed::~check_failed() noexcept = default;
222 no_entry::~no_entry() noexcept = default;
228 entry_exists::~entry_exists() noexcept = default;
234 not_empty::~not_empty() noexcept = default;
240 version_mismatch::~version_mismatch() noexcept = default;
246 no_children_for_ephemerals::~no_children_for_ephemerals() noexcept = default;
250 std::
string("Could not commit transaction due to ") + to_string(underlying_cause)
251 + " on operation " + std::to_string(op_index)
253 _underlying_cause(underlying_cause),
257 transaction_failed::~transaction_failed() noexcept = default;
T * ptr
A simple, unowned pointer.
const std::error_category & error_category()
Get the std::error_category capable of describing ZooKeeper-provided error codes. ...
Code for transaction_failed.
Code for new_configuration_no_quorum.
Code for connection_loss.
Operation was attempted that was not implemented.
std::exception_ptr get_exception_ptr_of(error_code code)
Get an std::exception_ptr containing an exception with the proper type for the given code...
Base error type for all errors raised by this library.
Code for no_children_for_ephemerals.
Arguments to an operation were invalid.
Code for marshalling_error.
void throw_error(error_code code)
Throw an exception for the given code.
Code for version_mismatch.
Invalid event (this should never be issued).
Code for reconfiguration_disabled.
Code for not_implemented.
Code for ephemeral_on_local_session.
Code for reconfiguration_in_progress.
Code for invalid_arguments.
Code for read_only_connection.
Code for authentication_failed.
Code for session_expired.
error_code
Code for all error types thrown by the client library.