19#include <boost/uuid/nil_generator.hpp>
21#include "hazelcast/client/exception/iexception.h"
22#include "hazelcast/client/protocol/ClientProtocolErrorCodes.h"
24#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
26#pragma warning(disable : 4251)
33class ClientInvocation;
37#define DEFINE_EXCEPTION_CLASS(ClassName, errorNo, isRuntime) \
38 class HAZELCAST_API ClassName : public iexception \
41 ClassName(std::string source, \
42 std::string message, \
43 std::string details = "", \
44 std::exception_ptr cause = nullptr, \
45 bool retryable = false) \
46 : ClassName(#ClassName, \
56 explicit ClassName(std::string message) \
57 : ClassName("", std::move(message)) \
64 ClassName(std::string errorName, \
67 std::string message, \
68 std::string details, \
69 std::exception_ptr cause, \
72 : iexception(std::move(errorName), \
86DEFINE_EXCEPTION_CLASS(undefined_error_code, protocol::UNDEFINED,
false);
88DEFINE_EXCEPTION_CLASS(execution, protocol::EXECUTION,
false);
90DEFINE_EXCEPTION_CLASS(class_not_found, protocol::CLASS_NOT_FOUND,
false);
92DEFINE_EXCEPTION_CLASS(eof, protocol::ENDOFFILE,
false);
94DEFINE_EXCEPTION_CLASS(io, protocol::IO,
false);
96DEFINE_EXCEPTION_CLASS(illegal_access,
97 protocol::ILLEGAL_ACCESS_EXCEPTION,
100DEFINE_EXCEPTION_CLASS(illegal_access_error,
101 protocol::ILLEGAL_ACCESS_ERROR,
104DEFINE_EXCEPTION_CLASS(interrupted, protocol::INTERRUPTED,
false);
106DEFINE_EXCEPTION_CLASS(not_serializable, protocol::NOT_SERIALIZABLE,
false);
108DEFINE_EXCEPTION_CLASS(socket, protocol::SOCK_ERROR,
false);
110DEFINE_EXCEPTION_CLASS(timeout, protocol::TIMEOUT,
false);
111DEFINE_EXCEPTION_CLASS(uri_syntax, protocol::URI_SYNTAX,
false);
112DEFINE_EXCEPTION_CLASS(utf_data_format, protocol::UTF_DATA_FORMAT,
false);
113DEFINE_EXCEPTION_CLASS(xa, protocol::XA,
false);
114DEFINE_EXCEPTION_CLASS(login, protocol::LOGIN,
false);
115DEFINE_EXCEPTION_CLASS(unsupported_callback,
116 protocol::UNSUPPORTED_CALLBACK,
118DEFINE_EXCEPTION_CLASS(assertion_error, protocol::ASSERTION_ERROR,
false);
119DEFINE_EXCEPTION_CLASS(out_of_memory_error,
120 protocol::OUT_OF_MEMORY_ERROR,
122DEFINE_EXCEPTION_CLASS(stack_overflow_error,
123 protocol::STACK_OVERFLOW_ERROR,
125DEFINE_EXCEPTION_CLASS(native_out_of_memory_error,
126 protocol::NATIVE_OUT_OF_MEMORY_ERROR,
131DEFINE_EXCEPTION_CLASS(array_index_out_of_bounds,
132 protocol::INDEX_OUT_OF_BOUNDS,
134DEFINE_EXCEPTION_CLASS(array_store, protocol::ARRAY_STORE,
true);
135DEFINE_EXCEPTION_CLASS(authentication, protocol::AUTHENTICATION,
true);
136DEFINE_EXCEPTION_CLASS(cache_not_exists, protocol::CACHE_NOT_EXISTS,
true);
137DEFINE_EXCEPTION_CLASS(cancellation, protocol::CANCELLATION,
true);
138DEFINE_EXCEPTION_CLASS(class_cast, protocol::CLASS_CAST,
true);
139DEFINE_EXCEPTION_CLASS(concurrent_modification,
140 protocol::CONCURRENT_MODIFICATION,
142DEFINE_EXCEPTION_CLASS(config_mismatch, protocol::CONFIG_MISMATCH,
true);
143DEFINE_EXCEPTION_CLASS(distributed_object_destroyed,
144 protocol::DISTRIBUTED_OBJECT_DESTROYED,
146DEFINE_EXCEPTION_CLASS(entry_processor, protocol::ENTRY_PROCESSOR,
true);
147DEFINE_EXCEPTION_CLASS(hazelcast_, protocol::HAZELCAST,
true);
148DEFINE_EXCEPTION_CLASS(hazelcast_instance_not_active,
149 protocol::HAZELCAST_INSTANCE_NOT_ACTIVE,
151DEFINE_EXCEPTION_CLASS(hazelcast_overload, protocol::HAZELCAST_OVERLOAD,
true);
152DEFINE_EXCEPTION_CLASS(hazelcast_serialization,
153 protocol::HAZELCAST_SERIALIZATION,
155DEFINE_EXCEPTION_CLASS(illegal_argument, protocol::ILLEGAL_ARGUMENT,
true);
156DEFINE_EXCEPTION_CLASS(illegal_monitor_state,
157 protocol::ILLEGAL_MONITOR_STATE,
159DEFINE_EXCEPTION_CLASS(illegal_state, protocol::ILLEGAL_STATE,
true);
160DEFINE_EXCEPTION_CLASS(illegal_thread_state,
161 protocol::ILLEGAL_THREAD_STATE,
163DEFINE_EXCEPTION_CLASS(index_out_of_bounds,
164 protocol::INDEX_OUT_OF_BOUNDS,
166DEFINE_EXCEPTION_CLASS(invalid_address, protocol::INVALID_ADDRESS,
true);
167DEFINE_EXCEPTION_CLASS(invalid_configuration,
168 protocol::INVALID_CONFIGURATION,
170DEFINE_EXCEPTION_CLASS(negative_array_size,
171 protocol::NEGATIVE_ARRAY_SIZE,
173DEFINE_EXCEPTION_CLASS(no_such_element, protocol::NO_SUCH_ELEMENT,
true);
174DEFINE_EXCEPTION_CLASS(null_pointer, protocol::NULL_POINTER,
true);
175DEFINE_EXCEPTION_CLASS(operation_timeout, protocol::OPERATION_TIMEOUT,
true);
176DEFINE_EXCEPTION_CLASS(query_result_size_exceeded,
177 protocol::QUERY_RESULT_SIZE_EXCEEDED,
179DEFINE_EXCEPTION_CLASS(split_brain_protection,
180 protocol::SPLIT_BRAIN_PROTECTION,
182DEFINE_EXCEPTION_CLASS(reached_max_size, protocol::REACHED_MAX_SIZE,
true);
183DEFINE_EXCEPTION_CLASS(rejected_execution, protocol::REJECTED_EXECUTION,
true);
184DEFINE_EXCEPTION_CLASS(response_already_sent,
185 protocol::RESPONSE_ALREADY_SENT,
187DEFINE_EXCEPTION_CLASS(runtime, protocol::RUNTIME,
true);
188DEFINE_EXCEPTION_CLASS(SecurityException, protocol::SECURITY,
true);
193DEFINE_EXCEPTION_CLASS(stale_sequence, protocol::STALE_SEQUENCE,
true);
194DEFINE_EXCEPTION_CLASS(target_disconnected,
195 protocol::TARGET_DISCONNECTED,
197DEFINE_EXCEPTION_CLASS(topic_overload, protocol::TOPIC_OVERLOAD,
true);
199DEFINE_EXCEPTION_CLASS(transaction, protocol::TRANSACTION,
true);
200DEFINE_EXCEPTION_CLASS(transaction_not_active,
201 protocol::TRANSACTION_NOT_ACTIVE,
203DEFINE_EXCEPTION_CLASS(transaction_timed_out,
204 protocol::TRANSACTION_TIMED_OUT,
206DEFINE_EXCEPTION_CLASS(unsupported_operation,
207 protocol::UNSUPPORTED_OPERATION,
209DEFINE_EXCEPTION_CLASS(access_control, protocol::ACCESS_CONTROL,
true);
210DEFINE_EXCEPTION_CLASS(no_data_member_in_cluster,
211 protocol::NO_DATA_MEMBER,
213DEFINE_EXCEPTION_CLASS(replicated_map_cant_be_created_on_lite_member,
214 protocol::REPLICATED_MAP_CANT_BE_CREATED,
216DEFINE_EXCEPTION_CLASS(max_message_size_exceeded,
217 protocol::MAX_MESSAGE_SIZE_EXCEEDED,
219DEFINE_EXCEPTION_CLASS(wan_replication_queue_full,
220 protocol::WAN_REPLICATION_QUEUE_FULL,
222DEFINE_EXCEPTION_CLASS(service_not_found, protocol::SERVICE_NOT_FOUND,
true);
224DEFINE_EXCEPTION_CLASS(stale_task_id, protocol::STALE_TASK_ID,
true);
226DEFINE_EXCEPTION_CLASS(duplicate_task, protocol::DUPLICATE_TASK,
true);
228DEFINE_EXCEPTION_CLASS(stale_task, protocol::STALE_TASK,
true);
230DEFINE_EXCEPTION_CLASS(local_member_reset, protocol::LOCAL_MEMBER_RESET,
true);
232DEFINE_EXCEPTION_CLASS(indeterminate_operation_state,
233 protocol::INDETERMINATE_OPERATION_STATE,
236DEFINE_EXCEPTION_CLASS(node_id_out_of_range,
237 protocol::FLAKE_ID_NODE_ID_OUT_OF_RANGE_EXCEPTION,
240DEFINE_EXCEPTION_CLASS(mutation_disallowed,
241 protocol::MUTATION_DISALLOWED_EXCEPTION,
244DEFINE_EXCEPTION_CLASS(session_expired,
245 protocol::SESSION_EXPIRED_EXCEPTION,
248DEFINE_EXCEPTION_CLASS(wait_key_cancelled,
249 protocol::WAIT_KEY_CANCELLED_EXCEPTION,
252DEFINE_EXCEPTION_CLASS(lock_acquire_limit_reached,
253 protocol::LOCK_ACQUIRE_LIMIT_REACHED_EXCEPTION,
256DEFINE_EXCEPTION_CLASS(lock_ownership_lost,
257 protocol::LOCK_OWNERSHIP_LOST_EXCEPTION,
260DEFINE_EXCEPTION_CLASS(cp_group_destroyed,
261 protocol::CP_GROUP_DESTROYED_EXCEPTION,
264DEFINE_EXCEPTION_CLASS(cannot_replicate,
265 protocol::CANNOT_REPLICATE_EXCEPTION,
268DEFINE_EXCEPTION_CLASS(leader_demoted,
269 protocol::LEADER_DEMOTED_EXCEPTION,
272DEFINE_EXCEPTION_CLASS(stale_append_request,
273 protocol::STALE_APPEND_REQUEST_EXCEPTION,
276DEFINE_EXCEPTION_CLASS(not_leader, protocol::NOT_LEADER_EXCEPTION,
true);
278DEFINE_EXCEPTION_CLASS(version_mismatch,
279 protocol::VERSION_MISMATCH_EXCEPTION,
282class HAZELCAST_API retryable_hazelcast :
public hazelcast_
285 retryable_hazelcast(std::string error_name,
290 std::exception_ptr cause,
294 explicit retryable_hazelcast(std::string source =
"",
295 std::string message =
"",
296 std::string details =
"",
297 std::exception_ptr cause =
nullptr);
300#define DEFINE_RETRYABLE_EXCEPTION_CLASS(ClassName, errorNo) \
301 class HAZELCAST_API ClassName : public retryable_hazelcast \
304 explicit ClassName(std::string source = "", \
305 std::string message = "", \
306 std::string details = "", \
307 std::exception_ptr cause = nullptr) \
308 : retryable_hazelcast(#ClassName, \
311 std::move(message), \
312 std::move(details), \
321DEFINE_RETRYABLE_EXCEPTION_CLASS(caller_not_member,
322 protocol::CALLER_NOT_MEMBER);
323DEFINE_RETRYABLE_EXCEPTION_CLASS(partition_migrating,
324 protocol::PARTITION_MIGRATING);
325DEFINE_RETRYABLE_EXCEPTION_CLASS(retryable_io, protocol::RETRYABLE_IO);
326DEFINE_RETRYABLE_EXCEPTION_CLASS(target_not_member,
327 protocol::TARGET_NOT_MEMBER);
328DEFINE_RETRYABLE_EXCEPTION_CLASS(wrong_target, protocol::WRONG_TARGET);
330DEFINE_RETRYABLE_EXCEPTION_CLASS(target_not_replica,
331 protocol::TARGET_NOT_REPLICA_EXCEPTION);
333class HAZELCAST_API query :
public hazelcast_
336 explicit query(std::string source =
"",
337 std::string message =
"",
338 std::string details =
"",
339 std::exception_ptr cause =
nullptr);
343 std::exception_ptr cause =
nullptr,
344 boost::uuids::uuid originating_member_id = boost::uuids::nil_uuid(),
345 std::string suggestion =
"");
347 int32_t code()
const;
349 const std::string& suggestion()
const;
351 const boost::uuids::uuid& originating_member_uuid()
const;
355 std::string suggestion_;
356 boost::uuids::uuid originating_member_uuid_;
359class HAZELCAST_API invocation_might_contain_compact_data :
public hazelcast_
362 explicit invocation_might_contain_compact_data(
364 const spi::impl::ClientInvocation& invocation);
367class HAZELCAST_API member_left :
public execution
370 explicit member_left(std::string source =
"",
371 std::string message =
"",
372 std::string details =
"",
373 std::exception_ptr cause =
nullptr);
383class HAZELCAST_API consistency_lost :
public hazelcast_
386 explicit consistency_lost(std::string source =
"",
387 std::string message =
"",
388 std::string details =
"",
389 std::exception_ptr cause =
nullptr);
392DEFINE_EXCEPTION_CLASS(hazelcast_client_not_active,
393 protocol::HAZELCAST_INSTANCE_NOT_ACTIVE,
396DEFINE_EXCEPTION_CLASS(hazelcast_client_offline,
397 protocol::HAZELCAST_CLIENT_OFFLINE,
408DEFINE_EXCEPTION_CLASS(unknown_host, protocol::UNKNOWN_HOST,
false);
410DEFINE_EXCEPTION_CLASS(client_not_allowed_in_cluster,
411 protocol::CLIENT_NOT_ALLOWED_IN_CLUSTER,
422#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)