1#ifndef _PRIVMXLIB_ENDPOINT_THREAD_EXT_EXCEPTION_HPP_
2#define _PRIVMXLIB_ENDPOINT_THREAD_EXT_EXCEPTION_HPP_
5#include "privmx/endpoint/core/Exception.hpp"
7#define DECLARE_SCOPE_ENDPOINT_EXCEPTION(NAME, MSG, SCOPE, CODE, ...) \
8 class NAME : public privmx::endpoint::core::Exception { \
10 NAME() : privmx::endpoint::core::Exception(MSG, #NAME, SCOPE, (CODE << 16)) {} \
11 NAME(const std::string& msg, const std::string& name, unsigned int code) \
12 : privmx::endpoint::core::Exception(msg, name, SCOPE, (CODE << 16) | code, std::string()) {} \
13 NAME(const std::string& msg, const std::string& name, unsigned int code, const std::string& description) \
14 : privmx::endpoint::core::Exception(msg, name, SCOPE, (CODE << 16) | code, description) {} \
15 void rethrow() const override; \
17 inline void NAME::rethrow() const { \
21#define DECLARE_ENDPOINT_EXCEPTION(BASE_SCOPED, NAME, MSG, CODE, ...) \
22 class NAME : public BASE_SCOPED { \
24 NAME() : BASE_SCOPED(MSG, #NAME, CODE) {} \
25 NAME(const std::string& new_of_description) : BASE_SCOPED(MSG, #NAME, CODE, new_of_description) {} \
26 void rethrow() const override; \
28 inline void NAME::rethrow() const { \
36#define ENDPOINT_THREAD_EXCEPTION_CODE 0x00030000
38DECLARE_SCOPE_ENDPOINT_EXCEPTION(EndpointThreadException,
"Unknown endpoint thread exception",
"Thread", 0x0003)
39DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, NotInitializedException,
"Endpoint not initialized", 0x0001)
40DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, CannotExtractThreadCreatedEventException,
"Cannot extract ThreadCreatedEvent", 0x0002)
41DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, CannotExtractThreadUpdatedEventException,
"Cannot extract ThreadUpdatedEvent", 0x0003)
42DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, CannotExtractThreadNewMessageEventException,
"Cannot extract ThreadNewMessageEvent", 0x0004)
43DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, CannotExtractThreadDeletedEventException,
"Cannot extract ThreadDeletedEvent", 0x0005)
44DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, CannotExtractThreadDeletedMessageEventException,
"Cannot extract ThreadDeletedMessageEvent", 0x0006)
45DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, IncorrectKeyIdFormatException,
"Incorrect key id format", 0x0007)
46DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, CannotExtractThreadStatsEventException,
"Cannot extract ThreadStatsEvent", 0x0008)
47DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, AlreadySubscribedException,
"Already subscribed", 0x0009)
48DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, NotSubscribedException,
"Cannot unsubscribe if not subscribed", 0x000A)
49DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, InvalidEncryptedThreadDataVersionException,
"Invalid version of encrypted thread data", 0x000B)
50DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, InvalidEncryptedMessageDataVersionException,
"Invalid version of encrypted message data", 0x000C)
51DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, UnknowThreadFormatException,
"Unknown Thread format", 0x000D)
52DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, UnknowMessageFormatException,
"Unknown Message format", 0x000E)
53DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, CannotExtractThreadMessageUpdatedEventException,
"Cannot extract ThreadMessageUpdatedEvent", 0x000F)
54DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, ThreadPublicDataMismatchException,
"Thread public data mismatch", 0x0010)
55DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, MessagePublicDataMismatchException,
"Message public data mismatch", 0x0011)
56DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, ThreadDataIntegrityException,
"Failed thread data integrity check", 0x0014)
57DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, MessageDataIntegrityException,
"Failed message data integrity check", 0x0015)
58DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, ThreadEncryptionKeyValidationException,
"Failed Thread encryption key validation", 0x0016)
59DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, NotImplementedException,
"Not Implemented", 0x0017)
60DECLARE_ENDPOINT_EXCEPTION(EndpointThreadException, InvalidSubscriptionQueryException,
"Invalid subscriptionQuery", 0x0018)
66#undef DECLARE_SCOPE_ENDPOINT_EXCEPTION
67#undef DECLARE_ENDPOINT_EXCEPTION