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 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 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(CallerNotMemberException, protocol::CALLER_NOT_MEMBER);
67 DEFINE_EXCEPTION_CLASS(CancellationException, protocol::CANCELLATION);
68 DEFINE_EXCEPTION_CLASS(ClassCastException, protocol::CLASS_CAST);
69 DEFINE_EXCEPTION_CLASS(ClassNotFoundException, protocol::CLASS_NOT_FOUND);
70 DEFINE_EXCEPTION_CLASS(ConcurrentModificationException, protocol::CONCURRENT_MODIFICATION);
71 DEFINE_EXCEPTION_CLASS(ConfigMismatchException, protocol::CONFIG_MISMATCH);
72 DEFINE_EXCEPTION_CLASS(ConfigurationException, protocol::CONFIGURATION);
73 DEFINE_EXCEPTION_CLASS(DistributedObjectDestroyedException, protocol::DISTRIBUTED_OBJECT_DESTROYED);
74 DEFINE_EXCEPTION_CLASS(DuplicateInstanceNameException, protocol::DUPLICATE_INSTANCE_NAME);
75 DEFINE_EXCEPTION_CLASS(EOFException, protocol::ENDOFFILE);
76 DEFINE_EXCEPTION_CLASS(ExecutionException, protocol::EXECUTION);
77 DEFINE_EXCEPTION_CLASS(HazelcastException, protocol::HAZELCAST);
78 DEFINE_EXCEPTION_CLASS(HazelcastInstanceNotActiveException, protocol::HAZELCAST_INSTANCE_NOT_ACTIVE);
79 DEFINE_EXCEPTION_CLASS(HazelcastOverloadException, protocol::HAZELCAST_OVERLOAD);
80 DEFINE_EXCEPTION_CLASS(HazelcastSerializationException, protocol::HAZELCAST_SERIALIZATION);
81 DEFINE_EXCEPTION_CLASS(IOException, protocol::IO);
82 DEFINE_EXCEPTION_CLASS(IllegalArgumentException, protocol::ILLEGAL_ARGUMENT);
83 DEFINE_EXCEPTION_CLASS(IllegalAccessException, protocol::ILLEGAL_ACCESS_EXCEPTION);
84 DEFINE_EXCEPTION_CLASS(IllegalAccessError, protocol::ILLEGAL_ACCESS_ERROR);
85 DEFINE_EXCEPTION_CLASS(IllegalMonitorStateException, protocol::ILLEGAL_MONITOR_STATE);
86 DEFINE_EXCEPTION_CLASS(IllegalStateException, protocol::ILLEGAL_STATE);
87 DEFINE_EXCEPTION_CLASS(IllegalThreadStateException, protocol::ILLEGAL_THREAD_STATE);
88 DEFINE_EXCEPTION_CLASS(IndexOutOfBoundsException, protocol::INDEX_OUT_OF_BOUNDS);
89 DEFINE_EXCEPTION_CLASS(InterruptedException, protocol::INTERRUPTED);
90 DEFINE_EXCEPTION_CLASS(InvalidAddressException, protocol::INVALID_ADDRESS);
91 DEFINE_EXCEPTION_CLASS(InvalidConfigurationException, protocol::INVALID_CONFIGURATION);
92 DEFINE_EXCEPTION_CLASS(MemberLeftException, protocol::MEMBER_LEFT);
93 DEFINE_EXCEPTION_CLASS(NegativeArraySizeException, protocol::NEGATIVE_ARRAY_SIZE);
94 DEFINE_EXCEPTION_CLASS(NoSuchElementException, protocol::NO_SUCH_ELEMENT);
95 DEFINE_EXCEPTION_CLASS(NotSerializableException, protocol::NOT_SERIALIZABLE);
96 DEFINE_EXCEPTION_CLASS(NullPointerException, protocol::NULL_POINTER);
97 DEFINE_EXCEPTION_CLASS(OperationTimeoutException, protocol::OPERATION_TIMEOUT);
98 DEFINE_EXCEPTION_CLASS(PartitionMigratingException, protocol::PARTITION_MIGRATING);
99 DEFINE_EXCEPTION_CLASS(QueryException, protocol::QUERY);
100 DEFINE_EXCEPTION_CLASS(QueryResultSizeExceededException, protocol::QUERY_RESULT_SIZE_EXCEEDED);
101 DEFINE_EXCEPTION_CLASS(QuorumException, protocol::QUORUM);
102 DEFINE_EXCEPTION_CLASS(ReachedMaxSizeException, protocol::REACHED_MAX_SIZE);
103 DEFINE_EXCEPTION_CLASS(RejectedExecutionException, protocol::REJECTED_EXECUTION);
104 DEFINE_EXCEPTION_CLASS(RemoteMapReduceException, protocol::REMOTE_MAP_REDUCE);
105 DEFINE_EXCEPTION_CLASS(ResponseAlreadySentException, protocol::RESPONSE_ALREADY_SENT);
106 DEFINE_EXCEPTION_CLASS(RetryableHazelcastException, protocol::RETRYABLE_HAZELCAST);
107 DEFINE_EXCEPTION_CLASS(RetryableIOException, protocol::RETRYABLE_IO);
108 DEFINE_EXCEPTION_CLASS(RuntimeException, protocol::RUNTIME);
109 DEFINE_EXCEPTION_CLASS(SecurityException, protocol::SECURITY);
110 DEFINE_EXCEPTION_CLASS(SocketException, protocol::SOCKET);
114 DEFINE_EXCEPTION_CLASS(StaleSequenceException, protocol::STALE_SEQUENCE);
115 DEFINE_EXCEPTION_CLASS(TargetDisconnectedException, protocol::TARGET_DISCONNECTED);
116 DEFINE_EXCEPTION_CLASS(TimeoutException, protocol::TIMEOUT);
117 DEFINE_EXCEPTION_CLASS(TopicOverloadException, protocol::TOPIC_OVERLOAD);
118 DEFINE_EXCEPTION_CLASS(TopologyChangedException, protocol::TOPOLOGY_CHANGED);
119 DEFINE_EXCEPTION_CLASS(TransactionException, protocol::TRANSACTION);
120 DEFINE_EXCEPTION_CLASS(TransactionNotActiveException, protocol::TRANSACTION_NOT_ACTIVE);
121 DEFINE_EXCEPTION_CLASS(TransactionTimedOutException, protocol::TRANSACTION_TIMED_OUT);
122 DEFINE_EXCEPTION_CLASS(URISyntaxException, protocol::URI_SYNTAX);
123 DEFINE_EXCEPTION_CLASS(UTFDataFormatException, protocol::UTF_DATA_FORMAT);
124 DEFINE_EXCEPTION_CLASS(UnsupportedOperationException, protocol::UNSUPPORTED_OPERATION);
125 DEFINE_EXCEPTION_CLASS(WrongTargetException, protocol::WRONG_TARGET);
126 DEFINE_EXCEPTION_CLASS(XAException, protocol::XA);
127 DEFINE_EXCEPTION_CLASS(AccessControlException, protocol::ACCESS_CONTROL);
128 DEFINE_EXCEPTION_CLASS(LoginException, protocol::LOGIN);
129 DEFINE_EXCEPTION_CLASS(UnsupportedCallbackException, protocol::UNSUPPORTED_CALLBACK);
130 DEFINE_EXCEPTION_CLASS(NoDataMemberInClusterException, protocol::NO_DATA_MEMBER);
131 DEFINE_EXCEPTION_CLASS(ReplicatedMapCantBeCreatedOnLiteMemberException, protocol::REPLICATED_MAP_CANT_BE_CREATED);
132 DEFINE_EXCEPTION_CLASS(MaxMessageSizeExceeded, protocol::MAX_MESSAGE_SIZE_EXCEEDED);
133 DEFINE_EXCEPTION_CLASS(WANReplicationQueueFullException, protocol::WAN_REPLICATION_QUEUE_FULL);
134 DEFINE_EXCEPTION_CLASS(AssertionError, protocol::ASSERTION_ERROR);
135 DEFINE_EXCEPTION_CLASS(OutOfMemoryError, protocol::OUT_OF_MEMORY_ERROR);
136 DEFINE_EXCEPTION_CLASS(StackOverflowError, protocol::STACK_OVERFLOW_ERROR);
137 DEFINE_EXCEPTION_CLASS(NativeOutOfMemoryError, protocol::NATIVE_OUT_OF_MEMORY_ERROR);
138 DEFINE_EXCEPTION_CLASS(ServiceNotFoundException, protocol::SERVICE_NOT_FOUND);
141 DEFINE_EXCEPTION_CLASS(HazelcastClientNotActiveException, protocol::HAZELCAST_INSTANCE_NOT_ACTIVE);
145 DEFINE_EXCEPTION_CLASS(HazelcastClientOfflineException, protocol::HAZELCAST_CLIENT_OFFLINE);
146 DEFINE_EXCEPTION_CLASS(UnknownHostException, protocol::UNKNOWN_HOST);
147 DEFINE_EXCEPTION_CLASS(FutureUninitialized, protocol::FUTURE_UNINITIALIZED);
152 const std::string &details, int32_t causeCode);
164 int32_t errorCode, int64_t correlationId,
165 std::string details);
169 int32_t getUndefinedErrorCode()
const;
171 int64_t getMessageCallId()
const;
173 const std::string &getDetailedErrorMessage()
const;
175 virtual std::auto_ptr<IException> clone()
const;
179 int64_t messageCallId;
180 std::string detailedErrorMessage;
186 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 190 #endif //HAZELCAST_CLIENT_EXCEPTION_PROTOCOLEXCEPTIONS_H_ Base class for all exception originated from Hazelcast methods.
Definition: IException.h:53
Definition: ProtocolExceptions.h:149
Definition: MapEntryView.h:32
Definition: ProtocolExceptions.h:161