Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exception.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Contact: Jan Olszak <j.olszak@samsung.com>
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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
17  */
18 
26 #ifndef CARGO_IPC_EXCEPTION_HPP
27 #define CARGO_IPC_EXCEPTION_HPP
28 
29 #include <stdexcept>
30 
31 namespace cargo {
32 namespace ipc {
33 
39 struct IPCException: public std::runtime_error {
40  explicit IPCException(const std::string& message)
41  : std::runtime_error(message) {}
42 };
43 
49  explicit IPCParsingException(const std::string& message = "Exception during reading/parsing data from the socket")
50  : IPCException(message) {}
51 };
52 
58  explicit IPCSerializationException(const std::string& message = "Exception during writing/serializing data to the socket")
59  : IPCException(message) {}
60 };
61 
67  explicit IPCPeerDisconnectedException(const std::string& message = "No such peer. Might got disconnected.")
68  : IPCException(message) {}
69 };
70 
76  explicit IPCNaughtyPeerException(const std::string& message = "Peer performed a forbidden action.")
77  : IPCException(message) {}
78 };
79 
85  explicit IPCRemovedPeerException(const std::string& message = "Removing peer")
86  : IPCException(message) {}
87 };
88 
94  explicit IPCClosingException(const std::string& message = "Closing IPC")
95  : IPCException(message) {}
96 };
97 
103  explicit IPCTimeoutException(const std::string& message)
104  : IPCException(message) {}
105 };
106 
112  IPCSocketException(const int code, const std::string& message)
113  : IPCException(message),
114  mCode(code)
115  {}
116 
117  int getCode() const
118  {
119  return mCode;
120  }
121 
122 private:
123  int mCode;
124 };
125 
131  IPCUserException(const int code, const std::string& message)
132  : IPCException(message),
133  mCode(code)
134  {}
135 
136  int getCode() const
137  {
138  return mCode;
139  }
140 
141 private:
142  int mCode;
143 };
144 
145 } // namespace ipc
146 } // namespace cargo
147 
148 #endif // CARGO_IPC_EXCEPTION_HPP
Exception to indicate error while removing peer.
Definition: exception.hpp:84
int mCode
Definition: exception.hpp:142
IPCSerializationException(const std::string &message="Exception during writing/serializing data to the socket")
Definition: exception.hpp:58
IPCNaughtyPeerException(const std::string &message="Peer performed a forbidden action.")
Definition: exception.hpp:76
IPCRemovedPeerException(const std::string &message="Removing peer")
Definition: exception.hpp:85
IPCTimeoutException(const std::string &message)
Definition: exception.hpp:103
Exception to indicate error while closing IPC channel.
Definition: exception.hpp:93
int mCode
Definition: exception.hpp:123
Exception to indicate timeout event error.
Definition: exception.hpp:102
Exception to indicate user error.
Definition: exception.hpp:130
IPCSocketException(const int code, const std::string &message)
Definition: exception.hpp:112
IPCPeerDisconnectedException(const std::string &message="No such peer. Might got disconnected.")
Definition: exception.hpp:67
Exception to indicate socket error.
Definition: exception.hpp:111
Definition: exception.hpp:39
int getCode() const
Definition: exception.hpp:136
IPCClosingException(const std::string &message="Closing IPC")
Definition: exception.hpp:94
Exception to indicate error while reading/parsing data from the socket.
Definition: exception.hpp:48
int getCode() const
Definition: exception.hpp:117
IPCException(const std::string &message)
Definition: exception.hpp:40
Exception to indicate error while writing/serializing data to the socket.
Definition: exception.hpp:57
Exception to indicate that requested peer is not available, i.e.
Definition: exception.hpp:66
IPCUserException(const int code, const std::string &message)
Definition: exception.hpp:131
IPCParsingException(const std::string &message="Exception during reading/parsing data from the socket")
Definition: exception.hpp:49
Exception to indicate that peer performed a forbidden action.
Definition: exception.hpp:75