error.h
Go to the documentation of this file.
1 /*
2  *
3  * D-Bus++ - C++ bindings for D-Bus
4  *
5  * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
6  *
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  */
23 
24 
25 #ifndef __DBUSXX_ERROR_H
26 #define __DBUSXX_ERROR_H
27 
28 #include "api.h"
29 #include "util.h"
30 
31 #include <exception>
32 
33 namespace DBus
34 {
35 
36 class Message;
37 class InternalError;
38 
39 class DXXAPI Error : public std::exception
40 {
41 public:
42 
43  Error();
44 
46 
47  Error(const char *name, const char *message);
48 
49  Error(Message &);
50 
51  ~Error() throw();
52 
53  const char *what() const throw();
54 
55  const char *name() const;
56 
57  const char *message() const;
58 
59  void set(const char *name, const char *message);
60  // parameters MUST be static strings
61 
62  bool is_set() const;
63 
64  operator bool() const
65  {
66  return is_set();
67  }
68 
69 private:
70 
72 };
73 
74 struct DXXAPI ErrorFailed : public Error
75 {
76  ErrorFailed(const char *message)
77  : Error("org.freedesktop.DBus.Error.Failed", message)
78  {}
79 };
80 
81 struct DXXAPI ErrorNoMemory : public Error
82 {
83  ErrorNoMemory(const char *message)
84  : Error("org.freedesktop.DBus.Error.NoMemory", message)
85  {}
86 };
87 
89 {
90  ErrorServiceUnknown(const char *message)
91  : Error("org.freedesktop.DBus.Error.ServiceUnknown", message)
92  {}
93 };
94 
96 {
97  ErrorNameHasNoOwner(const char *message)
98  : Error("org.freedesktop.DBus.Error.NameHasNoOwner", message)
99  {}
100 };
101 
102 struct DXXAPI ErrorNoReply : public Error
103 {
104  ErrorNoReply(const char *message)
105  : Error("org.freedesktop.DBus.Error.NoReply", message)
106  {}
107 };
108 
109 struct DXXAPI ErrorIOError : public Error
110 {
111  ErrorIOError(const char *message)
112  : Error("org.freedesktop.DBus.Error.IOError", message)
113  {}
114 };
115 
116 struct DXXAPI ErrorBadAddress : public Error
117 {
118  ErrorBadAddress(const char *message)
119  : Error("org.freedesktop.DBus.Error.BadAddress", message)
120  {}
121 };
122 
124 {
125  ErrorNotSupported(const char *message)
126  : Error("org.freedesktop.DBus.Error.NotSupported", message)
127  {}
128 };
129 
131 {
132  ErrorLimitsExceeded(const char *message)
133  : Error("org.freedesktop.DBus.Error.LimitsExceeded", message)
134  {}
135 };
136 
138 {
139  ErrorAccessDenied(const char *message)
140  : Error("org.freedesktop.DBus.Error.AccessDenied", message)
141  {}
142 };
143 
144 struct DXXAPI ErrorAuthFailed : public Error
145 {
146  ErrorAuthFailed(const char *message)
147  : Error("org.freedesktop.DBus.Error.AuthFailed", message)
148  {}
149 };
150 
151 struct DXXAPI ErrorNoServer : public Error
152 {
153  ErrorNoServer(const char *message)
154  : Error("org.freedesktop.DBus.Error.NoServer", message)
155  {}
156 };
157 
158 struct DXXAPI ErrorTimeout : public Error
159 {
160  ErrorTimeout(const char *message)
161  : Error("org.freedesktop.DBus.Error.Timeout", message)
162  {}
163 };
164 
165 struct DXXAPI ErrorNoNetwork : public Error
166 {
167  ErrorNoNetwork(const char *message)
168  : Error("org.freedesktop.DBus.Error.NoNetwork", message)
169  {}
170 };
171 
173 {
174  ErrorAddressInUse(const char *message)
175  : Error("org.freedesktop.DBus.Error.AddressInUse", message)
176  {}
177 };
178 
180 {
181  ErrorDisconnected(const char *message)
182  : Error("org.freedesktop.DBus.Error.Disconnected", message)
183  {}
184 };
185 
187 {
188  ErrorInvalidArgs(const char *message)
189  : Error("org.freedesktop.DBus.Error.InvalidArgs", message)
190  {}
191 };
192 
194 {
195  ErrorFileNotFound(const char *message)
196  : Error("org.freedesktop.DBus.Error.FileNotFound", message)
197  {}
198 };
199 
201 {
202  ErrorUnknownMethod(const char *message)
203  : Error("org.freedesktop.DBus.Error.UnknownMethod", message)
204  {}
205 };
206 
207 struct DXXAPI ErrorTimedOut : public Error
208 {
209  ErrorTimedOut(const char *message)
210  : Error("org.freedesktop.DBus.Error.TimedOut", message)
211  {}
212 };
213 
215 {
216  ErrorMatchRuleNotFound(const char *message)
217  : Error("org.freedesktop.DBus.Error.MatchRuleNotFound", message)
218  {}
219 };
220 
222 {
223  ErrorMatchRuleInvalid(const char *message)
224  : Error("org.freedesktop.DBus.Error.MatchRuleInvalid", message)
225  {}
226 };
227 
229 {
230  ErrorSpawnExecFailed(const char *message)
231  : Error("org.freedesktop.DBus.Error.Spawn.ExecFailed", message)
232  {}
233 };
234 
236 {
237  ErrorSpawnForkFailed(const char *message)
238  : Error("org.freedesktop.DBus.Error.Spawn.ForkFailed", message)
239  {}
240 };
241 
243 {
244  ErrorSpawnChildExited(const char *message)
245  : Error("org.freedesktop.DBus.Error.Spawn.ChildExited", message)
246  {}
247 };
248 
250 {
251  ErrorSpawnChildSignaled(const char *message)
252  : Error("org.freedesktop.DBus.Error.Spawn.ChildSignaled", message)
253  {}
254 };
255 
257 {
258  ErrorSpawnFailed(const char *message)
259  : Error("org.freedesktop.DBus.Error.Spawn.Failed", message)
260  {}
261 };
262 
264 {
265  ErrorInvalidSignature(const char *message)
266  : Error("org.freedesktop.DBus.Error.InvalidSignature", message)
267  {}
268 };
269 
271 {
272  ErrorUnixProcessIdUnknown(const char *message)
273  : Error("org.freedesktop.DBus.Error.UnixProcessIdUnknown", message)
274  {}
275 };
276 
278 {
280  : Error("org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", message)
281  {}
282 };
283 
285 {
286 public:
288  : Error("org.freedesktop.DBus.Error.ErrorSetAuthMechanisms", "set authentificaton mechanisms")
289  {}
290 };
291 
292 } /* namespace DBus */
293 
294 #endif//__DBUSXX_ERROR_H
ErrorInvalidSignature(const char *message)
Definition: error.h:265
ErrorDisconnected(const char *message)
Definition: error.h:181
ErrorUnixProcessIdUnknown(const char *message)
Definition: error.h:272
ErrorTimeout(const char *message)
Definition: error.h:160
ErrorAccessDenied(const char *message)
Definition: error.h:139
ErrorSpawnChildExited(const char *message)
Definition: error.h:244
ErrorNotSupported(const char *message)
Definition: error.h:125
ErrorNoServer(const char *message)
Definition: error.h:153
ErrorMatchRuleNotFound(const char *message)
Definition: error.h:216
ErrorUnknownMethod(const char *message)
Definition: error.h:202
ErrorNoMemory(const char *message)
Definition: error.h:83
ErrorAddressInUse(const char *message)
Definition: error.h:174
ErrorNoNetwork(const char *message)
Definition: error.h:167
ErrorIOError(const char *message)
Definition: error.h:111
ErrorTimedOut(const char *message)
Definition: error.h:209
ErrorMatchRuleInvalid(const char *message)
Definition: error.h:223
ErrorSELinuxSecurityContextUnknown(const char *message)
Definition: error.h:279
#define DXXAPI
Definition: api.h:36
ErrorSpawnFailed(const char *message)
Definition: error.h:258
ErrorSpawnExecFailed(const char *message)
Definition: error.h:230
ErrorInvalidArgs(const char *message)
Definition: error.h:188
ErrorBadAddress(const char *message)
Definition: error.h:118
ErrorSpawnForkFailed(const char *message)
Definition: error.h:237
ErrorNameHasNoOwner(const char *message)
Definition: error.h:97
ErrorFileNotFound(const char *message)
Definition: error.h:195
ErrorNoReply(const char *message)
Definition: error.h:104
ErrorAuthFailed(const char *message)
Definition: error.h:146
ErrorServiceUnknown(const char *message)
Definition: error.h:90
RefPtrI< InternalError > _int
Definition: error.h:71
ErrorSpawnChildSignaled(const char *message)
Definition: error.h:251
ErrorFailed(const char *message)
Definition: error.h:76
ErrorLimitsExceeded(const char *message)
Definition: error.h:132