19 #ifndef HAZELCAST_CLIENT_EXCEPTION_PROTOCOLEXCEPTIONS_H_ 20 #define HAZELCAST_CLIENT_EXCEPTION_PROTOCOLEXCEPTIONS_H_ 24 #include "hazelcast/client/exception/IException.h" 25 #include "hazelcast/client/protocol/ClientProtocolErrorCodes.h" 27 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 29 #pragma warning(disable: 4251) //for dll export 35 #define DEFINE_EXCEPTION_CLASS(ClassName, errorNo, runtime) \ 36 class HAZELCAST_API ClassName : public virtual IException {\ 38 static const int32_t ERROR_CODE = errorNo;\ 39 ClassName(const std::string& source, const std::string& message, const std::string& details, \ 41 : IException(#ClassName, source, message, details, ERROR_CODE, causeCode, runtime) {\ 43 ClassName(const std::string& source, const std::string& message, int32_t causeCode) \ 44 : IException(#ClassName, source, message, ERROR_CODE, causeCode, runtime) {\ 46 ClassName(const std::string& source, const std::string& message) \ 47 : IException(#ClassName, source, message, ERROR_CODE, runtime) {\ 49 ClassName(const std::string& source) : IException(#ClassName, source, "", ERROR_CODE, runtime) {\ 51 ClassName(const std::string &source, const std::string &message, \ 52 const boost::shared_ptr<IException> &cause) \ 53 : IException(#ClassName, source, message, ERROR_CODE, cause, runtime) {}\ 54 ClassName(const std::string &source, const std::string &message, const IException &cause) \ 55 : IException(#ClassName, source, message, ERROR_CODE, boost::shared_ptr<IException>(cause.clone()), runtime) {}\ 56 virtual std::auto_ptr<IException> clone() const {\ 57 return std::auto_ptr<IException>(new ClassName(*this));\ 59 virtual void raise() const { throw *this; } \ 63 DEFINE_EXCEPTION_CLASS(ExecutionException, protocol::EXECUTION,
false);
64 DEFINE_EXCEPTION_CLASS(ClassNotFoundException, protocol::CLASS_NOT_FOUND,
false);
65 DEFINE_EXCEPTION_CLASS(EOFException, protocol::ENDOFFILE,
false);
66 DEFINE_EXCEPTION_CLASS(IOException, protocol::IO,
false);
67 DEFINE_EXCEPTION_CLASS(IllegalAccessException, protocol::ILLEGAL_ACCESS_EXCEPTION,
false);
68 DEFINE_EXCEPTION_CLASS(IllegalAccessError, protocol::ILLEGAL_ACCESS_ERROR,
false);
69 DEFINE_EXCEPTION_CLASS(InterruptedException, protocol::INTERRUPTED,
false);
70 DEFINE_EXCEPTION_CLASS(NotSerializableException, protocol::NOT_SERIALIZABLE,
false);
71 DEFINE_EXCEPTION_CLASS(SocketException, protocol::SOCKET,
false);
72 DEFINE_EXCEPTION_CLASS(TimeoutException, protocol::TIMEOUT,
false);
73 DEFINE_EXCEPTION_CLASS(URISyntaxException, protocol::URI_SYNTAX,
false);
74 DEFINE_EXCEPTION_CLASS(UTFDataFormatException, protocol::UTF_DATA_FORMAT,
false);
75 DEFINE_EXCEPTION_CLASS(XAException, protocol::XA,
false);
76 DEFINE_EXCEPTION_CLASS(LoginException, protocol::LOGIN,
false);
77 DEFINE_EXCEPTION_CLASS(UnsupportedCallbackException, protocol::UNSUPPORTED_CALLBACK,
false);
78 DEFINE_EXCEPTION_CLASS(AssertionError, protocol::ASSERTION_ERROR,
false);
79 DEFINE_EXCEPTION_CLASS(OutOfMemoryError, protocol::OUT_OF_MEMORY_ERROR,
false);
80 DEFINE_EXCEPTION_CLASS(StackOverflowError, protocol::STACK_OVERFLOW_ERROR,
false);
81 DEFINE_EXCEPTION_CLASS(NativeOutOfMemoryError, protocol::NATIVE_OUT_OF_MEMORY_ERROR,
false);
85 DEFINE_EXCEPTION_CLASS(ArrayIndexOutOfBoundsException, protocol::INDEX_OUT_OF_BOUNDS,
true);
86 DEFINE_EXCEPTION_CLASS(ArrayStoreException, protocol::ARRAY_STORE,
true);
87 DEFINE_EXCEPTION_CLASS(AuthenticationException, protocol::AUTHENTICATIONERROR,
true);
88 DEFINE_EXCEPTION_CLASS(CacheNotExistsException, protocol::CACHE_NOT_EXISTS,
true);
89 DEFINE_EXCEPTION_CLASS(CancellationException, protocol::CANCELLATION,
true);
90 DEFINE_EXCEPTION_CLASS(ClassCastException, protocol::CLASS_CAST,
true);
91 DEFINE_EXCEPTION_CLASS(ConcurrentModificationException, protocol::CONCURRENT_MODIFICATION,
true);
92 DEFINE_EXCEPTION_CLASS(ConfigMismatchException, protocol::CONFIG_MISMATCH,
true);
93 DEFINE_EXCEPTION_CLASS(ConfigurationException, protocol::CONFIGURATION,
true);
94 DEFINE_EXCEPTION_CLASS(DistributedObjectDestroyedException, protocol::DISTRIBUTED_OBJECT_DESTROYED,
true);
95 DEFINE_EXCEPTION_CLASS(DuplicateInstanceNameException, protocol::DUPLICATE_INSTANCE_NAME,
true);
96 DEFINE_EXCEPTION_CLASS(HazelcastException, protocol::HAZELCAST,
true);
97 DEFINE_EXCEPTION_CLASS(HazelcastInstanceNotActiveException, protocol::HAZELCAST_INSTANCE_NOT_ACTIVE,
true);
98 DEFINE_EXCEPTION_CLASS(HazelcastOverloadException, protocol::HAZELCAST_OVERLOAD,
true);
99 DEFINE_EXCEPTION_CLASS(HazelcastSerializationException, protocol::HAZELCAST_SERIALIZATION,
true);
100 DEFINE_EXCEPTION_CLASS(IllegalArgumentException, protocol::ILLEGAL_ARGUMENT,
true);
101 DEFINE_EXCEPTION_CLASS(IllegalMonitorStateException, protocol::ILLEGAL_MONITOR_STATE,
true);
102 DEFINE_EXCEPTION_CLASS(IllegalStateException, protocol::ILLEGAL_STATE,
true);
103 DEFINE_EXCEPTION_CLASS(IllegalThreadStateException, protocol::ILLEGAL_THREAD_STATE,
true);
104 DEFINE_EXCEPTION_CLASS(IndexOutOfBoundsException, protocol::INDEX_OUT_OF_BOUNDS,
true);
105 DEFINE_EXCEPTION_CLASS(InvalidAddressException, protocol::INVALID_ADDRESS,
true);
106 DEFINE_EXCEPTION_CLASS(InvalidConfigurationException, protocol::INVALID_CONFIGURATION,
true);
107 DEFINE_EXCEPTION_CLASS(NegativeArraySizeException, protocol::NEGATIVE_ARRAY_SIZE,
true);
108 DEFINE_EXCEPTION_CLASS(NoSuchElementException, protocol::NO_SUCH_ELEMENT,
true);
109 DEFINE_EXCEPTION_CLASS(NullPointerException, protocol::NULL_POINTER,
true);
110 DEFINE_EXCEPTION_CLASS(OperationTimeoutException, protocol::OPERATION_TIMEOUT,
true);
111 DEFINE_EXCEPTION_CLASS(QueryException, protocol::QUERY,
true);
112 DEFINE_EXCEPTION_CLASS(QueryResultSizeExceededException, protocol::QUERY_RESULT_SIZE_EXCEEDED,
true);
113 DEFINE_EXCEPTION_CLASS(QuorumException, protocol::QUORUM,
true);
114 DEFINE_EXCEPTION_CLASS(ReachedMaxSizeException, protocol::REACHED_MAX_SIZE,
true);
115 DEFINE_EXCEPTION_CLASS(RejectedExecutionException, protocol::REJECTED_EXECUTION,
true);
116 DEFINE_EXCEPTION_CLASS(RemoteMapReduceException, protocol::REMOTE_MAP_REDUCE,
true);
117 DEFINE_EXCEPTION_CLASS(ResponseAlreadySentException, protocol::RESPONSE_ALREADY_SENT,
true);
118 DEFINE_EXCEPTION_CLASS(RuntimeException, protocol::RUNTIME,
true);
119 DEFINE_EXCEPTION_CLASS(SecurityException, protocol::SECURITY,
true);
123 DEFINE_EXCEPTION_CLASS(StaleSequenceException, protocol::STALE_SEQUENCE,
true);
124 DEFINE_EXCEPTION_CLASS(TargetDisconnectedException, protocol::TARGET_DISCONNECTED,
true);
125 DEFINE_EXCEPTION_CLASS(TopicOverloadException, protocol::TOPIC_OVERLOAD,
true);
127 DEFINE_EXCEPTION_CLASS(TopologyChangedException, protocol::TOPOLOGY_CHANGED,
true);
128 DEFINE_EXCEPTION_CLASS(TransactionException, protocol::TRANSACTION,
true);
129 DEFINE_EXCEPTION_CLASS(TransactionNotActiveException, protocol::TRANSACTION_NOT_ACTIVE,
true);
130 DEFINE_EXCEPTION_CLASS(TransactionTimedOutException, protocol::TRANSACTION_TIMED_OUT,
true);
131 DEFINE_EXCEPTION_CLASS(UnsupportedOperationException, protocol::UNSUPPORTED_OPERATION,
true);
132 DEFINE_EXCEPTION_CLASS(AccessControlException, protocol::ACCESS_CONTROL,
true);
133 DEFINE_EXCEPTION_CLASS(NoDataMemberInClusterException, protocol::NO_DATA_MEMBER,
true);
134 DEFINE_EXCEPTION_CLASS(ReplicatedMapCantBeCreatedOnLiteMemberException, protocol::REPLICATED_MAP_CANT_BE_CREATED,
true);
135 DEFINE_EXCEPTION_CLASS(MaxMessageSizeExceeded, protocol::MAX_MESSAGE_SIZE_EXCEEDED,
true);
136 DEFINE_EXCEPTION_CLASS(WANReplicationQueueFullException, protocol::WAN_REPLICATION_QUEUE_FULL,
true);
137 DEFINE_EXCEPTION_CLASS(ServiceNotFoundException, protocol::SERVICE_NOT_FOUND,
true);
139 DEFINE_EXCEPTION_CLASS(StaleTaskIdException, protocol::STALE_TASK_ID,
true);
141 DEFINE_EXCEPTION_CLASS(DuplicateTaskException, protocol::DUPLICATE_TASK,
true);
143 DEFINE_EXCEPTION_CLASS(StaleTaskException, protocol::STALE_TASK,
true);
145 DEFINE_EXCEPTION_CLASS(LocalMemberResetException, protocol::LOCAL_MEMBER_RESET,
true);
147 DEFINE_EXCEPTION_CLASS(IndeterminateOperationStateException, protocol::INDETERMINATE_OPERATION_STATE,
true);
149 DEFINE_EXCEPTION_CLASS(NodeIdOutOfRangeException, protocol::FLAKE_ID_NODE_ID_OUT_OF_RANGE_EXCEPTION,
true);
151 DEFINE_EXCEPTION_CLASS(MutationDisallowedException, protocol::MUTATION_DISALLOWED_EXCEPTION,
true);
156 const std::string &details, int32_t causeCode);
163 const boost::shared_ptr<IException> &cause);
166 #define DEFINE_RETRYABLE_EXCEPTION_CLASS(ClassName, errorNo) \ 167 class HAZELCAST_API ClassName : public RetryableHazelcastException {\ 169 static const int32_t ERROR_CODE = errorNo;\ 170 ClassName(const std::string& source, const std::string& message, const std::string& details, \ 172 : IException(#ClassName, source, message, details, ERROR_CODE, causeCode, true, true), RetryableHazelcastException(source, message, details, causeCode) {\ 174 ClassName(const std::string& source, const std::string& message, int32_t causeCode) \ 175 : IException(#ClassName, source, message, ERROR_CODE, causeCode, true, true), RetryableHazelcastException(source, message, causeCode) {\ 177 ClassName(const std::string& source, const std::string& message) \ 178 : IException(#ClassName, source, message, ERROR_CODE, true, true), RetryableHazelcastException(source, message) {\ 180 ClassName(const std::string &source, const std::string &message, \ 181 const boost::shared_ptr<IException> &cause) \ 182 : IException(#ClassName, source, message, ERROR_CODE, boost::shared_ptr<IException>(cause->clone()), true, true), RetryableHazelcastException(source, message, cause) {}\ 183 virtual std::auto_ptr<IException> clone() const {\ 184 return std::auto_ptr<IException>(new ClassName(*this));\ 186 virtual void raise() const { throw *this; } \ 190 DEFINE_RETRYABLE_EXCEPTION_CLASS(CallerNotMemberException, protocol::CALLER_NOT_MEMBER);
191 DEFINE_RETRYABLE_EXCEPTION_CLASS(PartitionMigratingException, protocol::PARTITION_MIGRATING);
192 DEFINE_RETRYABLE_EXCEPTION_CLASS(RetryableIOException, protocol::RETRYABLE_IO);
193 DEFINE_RETRYABLE_EXCEPTION_CLASS(TargetNotMemberException, protocol::TARGET_NOT_MEMBER);
194 DEFINE_RETRYABLE_EXCEPTION_CLASS(WrongTargetException, protocol::WRONG_TARGET);
196 DEFINE_RETRYABLE_EXCEPTION_CLASS(TargetNotReplicaException, protocol::TARGET_NOT_REPLICA_EXCEPTION);
200 MemberLeftException(
const std::string &source,
const std::string &message,
const std::string &details,
203 MemberLeftException(
const std::string &source,
const std::string &message, int32_t causeCode);
207 virtual void raise()
const;
209 virtual std::auto_ptr<IException> clone()
const;
217 DEFINE_EXCEPTION_CLASS(HazelcastClientNotActiveException, protocol::HAZELCAST_INSTANCE_NOT_ACTIVE,
true);
218 DEFINE_EXCEPTION_CLASS(HazelcastClientOfflineException, protocol::HAZELCAST_CLIENT_OFFLINE,
true);
219 DEFINE_EXCEPTION_CLASS(ConsistencyLostException, protocol::CONSISTENCY_LOST,
true);
224 int32_t errorCode, int64_t correlationId,
225 std::string details);
229 int32_t getUndefinedErrorCode()
const;
231 int64_t getMessageCallId()
const;
233 const std::string &getDetailedErrorMessage()
const;
235 virtual std::auto_ptr<IException> clone()
const;
237 virtual void raise()
const;
241 int64_t messageCallId;
242 std::string detailedErrorMessage;
250 DEFINE_EXCEPTION_CLASS(UnknownHostException, protocol::UNKNOWN_HOST,
false);
251 DEFINE_EXCEPTION_CLASS(FutureUninitialized, protocol::FUTURE_UNINITIALIZED,
false);
259 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 263 #endif //HAZELCAST_CLIENT_EXCEPTION_PROTOCOLEXCEPTIONS_H_ Definition: ProtocolExceptions.h:198
Base class for all exception originated from Hazelcast methods.
Definition: IException.h:53
Definition: ProtocolExceptions.h:153
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32
Definition: ProtocolExceptions.h:221