2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Jan Olszak <j.olszak@samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
21 * @author Jan Olszak (j.olszak@samsung.com)
22 * @brief Exceptions for the IPC
26 #ifndef COMMON_IPC_EXCEPTION_HPP
27 #define COMMON_IPC_EXCEPTION_HPP
34 * @brief Base class for all exceptions in libIpc.
36 * @defgroup IPCException IPCException
38 struct IPCException: public std::runtime_error {
39 explicit IPCException(const std::string& message)
40 : std::runtime_error(message) {}
44 * Exception to indicate error while reading/parsing data from the socket.
45 * @ingroup IPCException
47 struct IPCParsingException: public IPCException {
48 explicit IPCParsingException(const std::string& message = "Exception during reading/parsing data from the socket")
49 : IPCException(message) {}
53 * Exception to indicate error while writing/serializing data to the socket.
54 * @ingroup IPCException
56 struct IPCSerializationException: public IPCException {
57 explicit IPCSerializationException(const std::string& message = "Exception during writing/serializing data to the socket")
58 : IPCException(message) {}
62 * Exception to indicate that requested peer is not available, i.e. might got disconnected.
63 * @ingroup IPCException
65 struct IPCPeerDisconnectedException: public IPCException {
66 explicit IPCPeerDisconnectedException(const std::string& message = "No such peer. Might got disconnected.")
67 : IPCException(message) {}
71 * Exception to indicate that peer performed a forbidden action.
72 * @ingroup IPCException
74 struct IPCNaughtyPeerException: public IPCException {
75 explicit IPCNaughtyPeerException(const std::string& message = "Peer performed a forbidden action.")
76 : IPCException(message) {}
80 * Exception to indicate error while removing peer
81 * @ingroup IPCException
83 struct IPCRemovedPeerException: public IPCException {
84 explicit IPCRemovedPeerException(const std::string& message = "Removing peer")
85 : IPCException(message) {}
89 * Exception to indicate error while closing IPC channel
90 * @ingroup IPCException
92 struct IPCClosingException: public IPCException {
93 explicit IPCClosingException(const std::string& message = "Closing IPC")
94 : IPCException(message) {}
98 * Exception to indicate timeout event error
99 * @ingroup IPCException
101 struct IPCTimeoutException: public IPCException {
102 explicit IPCTimeoutException(const std::string& message)
103 : IPCException(message) {}
107 * Exception to indicate socket error
108 * @ingroup IPCException
110 struct IPCSocketException: public IPCException {
111 IPCSocketException(const int code, const std::string& message)
112 : IPCException(message),
126 * Exception to indicate user error
127 * @ingroup IPCException
129 struct IPCUserException: public IPCException {
130 IPCUserException(const int code, const std::string& message)
131 : IPCException(message),
146 #endif // COMMON_IPC_EXCEPTION_HPP