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) \ 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) {\ 43 ClassName(const std::string& source, const std::string& message, int32_t causeCode) \ 44 : IException(#ClassName, source, message, ERROR_CODE, causeCode) {\ 46 ClassName(const std::string& source, const std::string& message) \ 47 : IException(#ClassName, source, message, ERROR_CODE) {\ 49 ClassName(const std::string& source) : IException(#ClassName, source, "", ERROR_CODE) {\ 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) {}\ 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())) {}\ 56 virtual std::auto_ptr<IException> clone() const {\ 57 return std::auto_ptr<IException>(new ClassName(*this));\ 59 virtual void raise() const { throw *this; } \ 62 DEFINE_EXCEPTION_CLASS(ArrayIndexOutOfBoundsException, protocol::INDEX_OUT_OF_BOUNDS);
63 DEFINE_EXCEPTION_CLASS(ArrayStoreException, protocol::ARRAY_STORE);
64 DEFINE_EXCEPTION_CLASS(AuthenticationException, protocol::AUTHENTICATIONERROR);
65 DEFINE_EXCEPTION_CLASS(CacheNotExistsException, protocol::CACHE_NOT_EXISTS);
66 DEFINE_EXCEPTION_CLASS(CancellationException, protocol::CANCELLATION);
67 DEFINE_EXCEPTION_CLASS(ClassCastException, protocol::CLASS_CAST);
68 DEFINE_EXCEPTION_CLASS(ClassNotFoundException, protocol::CLASS_NOT_FOUND);
69 DEFINE_EXCEPTION_CLASS(ConcurrentModificationException, protocol::CONCURRENT_MODIFICATION);
70 DEFINE_EXCEPTION_CLASS(ConfigMismatchException, protocol::CONFIG_MISMATCH);
71 DEFINE_EXCEPTION_CLASS(ConfigurationException, protocol::CONFIGURATION);
72 DEFINE_EXCEPTION_CLASS(DistributedObjectDestroyedException, protocol::DISTRIBUTED_OBJECT_DESTROYED);
73 DEFINE_EXCEPTION_CLASS(DuplicateInstanceNameException, protocol::DUPLICATE_INSTANCE_NAME);
74 DEFINE_EXCEPTION_CLASS(EOFException, protocol::ENDOFFILE);
75 DEFINE_EXCEPTION_CLASS(ExecutionException, protocol::EXECUTION);
76 DEFINE_EXCEPTION_CLASS(HazelcastException, protocol::HAZELCAST);
77 DEFINE_EXCEPTION_CLASS(HazelcastInstanceNotActiveException, protocol::HAZELCAST_INSTANCE_NOT_ACTIVE);
78 DEFINE_EXCEPTION_CLASS(HazelcastOverloadException, protocol::HAZELCAST_OVERLOAD);
79 DEFINE_EXCEPTION_CLASS(HazelcastSerializationException, protocol::HAZELCAST_SERIALIZATION);
80 DEFINE_EXCEPTION_CLASS(IOException, protocol::IO);
81 DEFINE_EXCEPTION_CLASS(IllegalArgumentException, protocol::ILLEGAL_ARGUMENT);
82 DEFINE_EXCEPTION_CLASS(IllegalAccessException, protocol::ILLEGAL_ACCESS_EXCEPTION);
83 DEFINE_EXCEPTION_CLASS(IllegalAccessError, protocol::ILLEGAL_ACCESS_ERROR);
84 DEFINE_EXCEPTION_CLASS(IllegalMonitorStateException, protocol::ILLEGAL_MONITOR_STATE);
85 DEFINE_EXCEPTION_CLASS(IllegalStateException, protocol::ILLEGAL_STATE);
86 DEFINE_EXCEPTION_CLASS(IllegalThreadStateException, protocol::ILLEGAL_THREAD_STATE);
87 DEFINE_EXCEPTION_CLASS(IndexOutOfBoundsException, protocol::INDEX_OUT_OF_BOUNDS);
88 DEFINE_EXCEPTION_CLASS(InterruptedException, protocol::INTERRUPTED);
89 DEFINE_EXCEPTION_CLASS(InvalidAddressException, protocol::INVALID_ADDRESS);
90 DEFINE_EXCEPTION_CLASS(InvalidConfigurationException, protocol::INVALID_CONFIGURATION);
91 DEFINE_EXCEPTION_CLASS(NegativeArraySizeException, protocol::NEGATIVE_ARRAY_SIZE);
92 DEFINE_EXCEPTION_CLASS(NoSuchElementException, protocol::NO_SUCH_ELEMENT);
93 DEFINE_EXCEPTION_CLASS(NotSerializableException, protocol::NOT_SERIALIZABLE);
94 DEFINE_EXCEPTION_CLASS(NullPointerException, protocol::NULL_POINTER);
95 DEFINE_EXCEPTION_CLASS(OperationTimeoutException, protocol::OPERATION_TIMEOUT);
96 DEFINE_EXCEPTION_CLASS(QueryException, protocol::QUERY);
97 DEFINE_EXCEPTION_CLASS(QueryResultSizeExceededException, protocol::QUERY_RESULT_SIZE_EXCEEDED);
98 DEFINE_EXCEPTION_CLASS(QuorumException, protocol::QUORUM);
99 DEFINE_EXCEPTION_CLASS(ReachedMaxSizeException, protocol::REACHED_MAX_SIZE);
100 DEFINE_EXCEPTION_CLASS(RejectedExecutionException, protocol::REJECTED_EXECUTION);
101 DEFINE_EXCEPTION_CLASS(RemoteMapReduceException, protocol::REMOTE_MAP_REDUCE);
102 DEFINE_EXCEPTION_CLASS(ResponseAlreadySentException, protocol::RESPONSE_ALREADY_SENT);
103 DEFINE_EXCEPTION_CLASS(RuntimeException, protocol::RUNTIME);
104 DEFINE_EXCEPTION_CLASS(SecurityException, protocol::SECURITY);
105 DEFINE_EXCEPTION_CLASS(SocketException, protocol::SOCKET);
109 DEFINE_EXCEPTION_CLASS(StaleSequenceException, protocol::STALE_SEQUENCE);
110 DEFINE_EXCEPTION_CLASS(TargetDisconnectedException, protocol::TARGET_DISCONNECTED);
111 DEFINE_EXCEPTION_CLASS(TimeoutException, protocol::TIMEOUT);
112 DEFINE_EXCEPTION_CLASS(TopicOverloadException, protocol::TOPIC_OVERLOAD);
113 DEFINE_EXCEPTION_CLASS(TransactionException, protocol::TRANSACTION);
114 DEFINE_EXCEPTION_CLASS(TransactionNotActiveException, protocol::TRANSACTION_NOT_ACTIVE);
115 DEFINE_EXCEPTION_CLASS(TransactionTimedOutException, protocol::TRANSACTION_TIMED_OUT);
116 DEFINE_EXCEPTION_CLASS(URISyntaxException, protocol::URI_SYNTAX);
117 DEFINE_EXCEPTION_CLASS(UTFDataFormatException, protocol::UTF_DATA_FORMAT);
118 DEFINE_EXCEPTION_CLASS(UnsupportedOperationException, protocol::UNSUPPORTED_OPERATION);
119 DEFINE_EXCEPTION_CLASS(XAException, protocol::XA);
120 DEFINE_EXCEPTION_CLASS(AccessControlException, protocol::ACCESS_CONTROL);
121 DEFINE_EXCEPTION_CLASS(LoginException, protocol::LOGIN);
122 DEFINE_EXCEPTION_CLASS(UnsupportedCallbackException, protocol::UNSUPPORTED_CALLBACK);
123 DEFINE_EXCEPTION_CLASS(NoDataMemberInClusterException, protocol::NO_DATA_MEMBER);
124 DEFINE_EXCEPTION_CLASS(ReplicatedMapCantBeCreatedOnLiteMemberException, protocol::REPLICATED_MAP_CANT_BE_CREATED);
125 DEFINE_EXCEPTION_CLASS(MaxMessageSizeExceeded, protocol::MAX_MESSAGE_SIZE_EXCEEDED);
126 DEFINE_EXCEPTION_CLASS(WANReplicationQueueFullException, protocol::WAN_REPLICATION_QUEUE_FULL);
127 DEFINE_EXCEPTION_CLASS(AssertionError, protocol::ASSERTION_ERROR);
128 DEFINE_EXCEPTION_CLASS(OutOfMemoryError, protocol::OUT_OF_MEMORY_ERROR);
129 DEFINE_EXCEPTION_CLASS(StackOverflowError, protocol::STACK_OVERFLOW_ERROR);
130 DEFINE_EXCEPTION_CLASS(NativeOutOfMemoryError, protocol::NATIVE_OUT_OF_MEMORY_ERROR);
131 DEFINE_EXCEPTION_CLASS(ServiceNotFoundException, protocol::SERVICE_NOT_FOUND);
134 DEFINE_EXCEPTION_CLASS(HazelcastClientNotActiveException, protocol::HAZELCAST_INSTANCE_NOT_ACTIVE);
138 DEFINE_EXCEPTION_CLASS(HazelcastClientOfflineException, protocol::HAZELCAST_CLIENT_OFFLINE);
139 DEFINE_EXCEPTION_CLASS(UnknownHostException, protocol::UNKNOWN_HOST);
140 DEFINE_EXCEPTION_CLASS(FutureUninitialized, protocol::FUTURE_UNINITIALIZED);
141 DEFINE_EXCEPTION_CLASS(ConsistencyLostException, protocol::CONSISTENCY_LOST);
146 const std::string &details, int32_t causeCode);
153 const boost::shared_ptr<IException> &cause);
156 #define DEFINE_RETRYABLE_EXCEPTION_CLASS(ClassName, errorNo) \ 157 class HAZELCAST_API ClassName : public RetryableHazelcastException {\ 159 static const int32_t ERROR_CODE = errorNo;\ 160 ClassName(const std::string& source, const std::string& message, const std::string& details, \ 162 : IException(#ClassName, source, message, details, ERROR_CODE, causeCode), RetryableHazelcastException(source, message, details, causeCode) {\ 164 ClassName(const std::string& source, const std::string& message, int32_t causeCode) \ 165 : IException(#ClassName, source, message, ERROR_CODE, causeCode), RetryableHazelcastException(source, message, causeCode) {\ 167 ClassName(const std::string& source, const std::string& message) \ 168 : IException(#ClassName, source, message, ERROR_CODE), RetryableHazelcastException(source, message) {\ 170 ClassName(const std::string &source, const std::string &message, \ 171 const boost::shared_ptr<IException> &cause) \ 172 : IException(#ClassName, source, message, ERROR_CODE, boost::shared_ptr<IException>(cause->clone())), RetryableHazelcastException(source, message, cause) {}\ 173 virtual std::auto_ptr<IException> clone() const {\ 174 return std::auto_ptr<IException>(new ClassName(*this));\ 176 virtual void raise() const { throw *this; } \ 180 DEFINE_RETRYABLE_EXCEPTION_CLASS(CallerNotMemberException, protocol::CALLER_NOT_MEMBER);
181 DEFINE_RETRYABLE_EXCEPTION_CLASS(TopologyChangedException, protocol::TOPOLOGY_CHANGED);
182 DEFINE_RETRYABLE_EXCEPTION_CLASS(PartitionMigratingException, protocol::PARTITION_MIGRATING);
183 DEFINE_RETRYABLE_EXCEPTION_CLASS(RetryableIOException, protocol::RETRYABLE_IO);
184 DEFINE_RETRYABLE_EXCEPTION_CLASS(TargetNotMemberException, protocol::TARGET_NOT_MEMBER);
185 DEFINE_RETRYABLE_EXCEPTION_CLASS(WrongTargetException, protocol::WRONG_TARGET);
189 MemberLeftException(
const std::string &source,
const std::string &message,
const std::string &details,
192 MemberLeftException(
const std::string &source,
const std::string &message, int32_t causeCode);
196 virtual void raise()
const;
198 virtual std::auto_ptr<IException> clone()
const;
205 int32_t errorCode, int64_t correlationId,
206 std::string details);
210 int32_t getUndefinedErrorCode()
const;
212 int64_t getMessageCallId()
const;
214 const std::string &getDetailedErrorMessage()
const;
216 virtual std::auto_ptr<IException> clone()
const;
218 virtual void raise()
const;
222 int64_t messageCallId;
223 std::string detailedErrorMessage;
229 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 233 #endif //HAZELCAST_CLIENT_EXCEPTION_PROTOCOLEXCEPTIONS_H_ Definition: ProtocolExceptions.h:187
Base class for all exception originated from Hazelcast methods.
Definition: IException.h:53
Definition: ProtocolExceptions.h:143
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32
Definition: ProtocolExceptions.h:202