1#ifndef _PRIVMXLIB_ENDPOINT_EVENT_EXT_EXCEPTION_HPP_
2#define _PRIVMXLIB_ENDPOINT_EVENT_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_EVENT_EXCEPTION_CODE 0x00090000
38DECLARE_SCOPE_ENDPOINT_EXCEPTION(EndpointEventException,
"Unknown endpoint event exception",
"Event", 0x0009)
39DECLARE_ENDPOINT_EXCEPTION(EndpointEventException, NotInitializedException,
"Endpoint not initialized", 0x0001)
40DECLARE_ENDPOINT_EXCEPTION(EndpointEventException, ForbiddenChannelNameException,
"Forbidden channel name", 0x0002)
41DECLARE_ENDPOINT_EXCEPTION(EndpointEventException, CannotExtractContextCustomEvent,
"Cannot extract ContextCustomEvent", 0x0003)
42DECLARE_ENDPOINT_EXCEPTION(EndpointEventException, NotSubscribedException,
"Not subscribed", 0x0004)
43DECLARE_ENDPOINT_EXCEPTION(EndpointEventException, AlreadySubscribedException,
"Already subscribed", 0x0005)
44DECLARE_ENDPOINT_EXCEPTION(EndpointEventException, InvalidEncryptedEventDataVersionException,
"Invalid version of encrypted event data", 0x0005)
45DECLARE_ENDPOINT_EXCEPTION(EndpointEventException, InvalidSubscriptionQueryException,
"Invalid subscriptionQuery", 0x0006)
51#undef DECLARE_SCOPE_ENDPOINT_EXCEPTION
52#undef DECLARE_ENDPOINT_EXCEPTION