BAOS SDK v2  1.2.1
An SDK providing access to IP-BAOS devices through BAOS binary protocol version 2.x
Loading...
Searching...
No Matches
Exception.h
Go to the documentation of this file.
1//
2// Copyright (c) 2002-2026 WEINZIERL ENGINEERING GmbH
3// All rights reserved.
4//
5// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
8// SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY,
9// WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
10// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
11//
12
13#include "baos/BaosLib_export.h"
14
15#include "wzcpp/features/error/Exception.h"
16
17#ifndef __BAOSLIB_EXCEPTION_H__
18#define __BAOSLIB_EXCEPTION_H__
19
21#include <sstream>
23
29namespace wz::baos
30{
31
32
40enum class ErrorCodes
41{
42 BaosError = 2,
43 SocketError = 3,
44 AddressResolveError = 4,
45 TCPConnectionError = 5,
46 TCPConnectionClosed = 6,
47 SocketRecvError = 7,
48 SocketSendError = 8,
49 SocketInitError = 9,
50 SocketRxBufferToSmall = 10,
51 ResponseError = 20,
52 ResponseTimeoutError = 21,
53 MaleformedTelegram = 22,
54 ConnectResponseTimeoutError = 23,
55 GenericSecurityError = 30,
56 AuthenticationFailedError = 31,
57 DeviceAuthenticationCodeInvalidError = 32,
58 UnauthenticatedError = 33,
59 ReceivedSessionKeepAliveError = 34,
60 ClosedSecuritySessionError = 35,
61 ClosedConnection = 51,
62 StoppedConnection = 52
63};
64
65DECLARE_WZ_EXCEPTION(WzBaosException,
66 ErrorCodes::BaosError,
67 wzcpp::error::WzBaseException);
68DECLARE_WZ_EXCEPTION(WzSocketException,
69 ErrorCodes::SocketError,
70 WzBaosException);
71DECLARE_WZ_EXCEPTION(WzIpAddressResolveException,
72 ErrorCodes::AddressResolveError,
73 WzSocketException);
74DECLARE_WZ_EXCEPTION(WzTCPConnectionException,
75 ErrorCodes::TCPConnectionError,
76 WzSocketException);
77DECLARE_WZ_EXCEPTION(WzTCPConnectionClosedException,
78 ErrorCodes::TCPConnectionClosed,
79 WzSocketException);
80DECLARE_WZ_EXCEPTION(WzRecvException,
81 ErrorCodes::SocketRecvError,
82 WzSocketException);
83DECLARE_WZ_EXCEPTION(WzSendException,
84 ErrorCodes::SocketSendError,
85 WzSocketException);
86DECLARE_WZ_EXCEPTION(WzSocketInitException,
87 ErrorCodes::SocketInitError,
88 WzSocketException);
89DECLARE_WZ_EXCEPTION(WzRxBufferOverflowException,
90 ErrorCodes::SocketRxBufferToSmall,
91 WzSocketException);
93
94DECLARE_WZ_EXCEPTION(WzMaleformedTelegramException,
95 ErrorCodes::MaleformedTelegram,
96 WzBaosException);
97DECLARE_WZ_EXCEPTION(WzResponseException,
98 ErrorCodes::ResponseError,
99 WzBaosException);
100DECLARE_WZ_EXCEPTION(WzResponseTimeoutException,
101 ErrorCodes::ResponseTimeoutError,
102 WzBaosException);
103DECLARE_WZ_EXCEPTION(WzConnectResponseTimeoutException,
104 ErrorCodes::ConnectResponseTimeoutError,
105 WzBaosException);
106DECLARE_WZ_EXCEPTION(WzClosedConnectionException,
107 ErrorCodes::ClosedConnection,
108 WzBaosException);
110 WzStoppedConnectionException,
111 ErrorCodes::StoppedConnection,
112 WzBaosException);
113DECLARE_WZ_EXCEPTION(WzGenericSecurityException,
114 ErrorCodes::GenericSecurityError,
115 WzBaosException);
116
117DECLARE_WZ_EXCEPTION(WzAuthenticationFailedException,
118 ErrorCodes::AuthenticationFailedError,
119 WzGenericSecurityException);
120DECLARE_WZ_EXCEPTION(DeviceAuthenticationCodeInvalidException,
121 ErrorCodes::DeviceAuthenticationCodeInvalidError,
122 WzGenericSecurityException);
123DECLARE_WZ_EXCEPTION(WzUnauthenticatedException,
124 ErrorCodes::UnauthenticatedError,
125 WzGenericSecurityException);
126DECLARE_WZ_EXCEPTION(WzReceivedSessionKeepAliveException,
127 ErrorCodes::ReceivedSessionKeepAliveError,
128 WzGenericSecurityException);
129DECLARE_WZ_EXCEPTION(WzClosedSecuritySessionException,
130 ErrorCodes::ClosedSecuritySessionError,
131 WzGenericSecurityException);
132} // namespace wz::baos
133
134#endif // __BAOSLIB_EXCEPTION_H__
Global BAOS sdk namespace.
Definition config.h:69
ErrorCodes
Custom error codes for each exception.
Definition Exception.h:41
DECLARE_WZ_EXCEPTION(WzBaosException, ErrorCodes::BaosError, wzcpp::error::WzBaseException)
Generic exception from this SDK.