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
33namespace DBus
34{
35
36class Message;
37class InternalError;
38
39class DXXAPI Error : public std::exception
40{
41public:
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
69private:
70
72};
73
74struct DXXAPI ErrorFailed : public Error
75{
76 ErrorFailed(const char *message)
77 : Error("org.freedesktop.DBus.Error.Failed", message)
78 {}
79};
80
81struct DXXAPI ErrorNoMemory : public Error
82{
84 : Error("org.freedesktop.DBus.Error.NoMemory", message)
85 {}
86};
87
89{
91 : Error("org.freedesktop.DBus.Error.ServiceUnknown", message)
92 {}
93};
94
96{
98 : Error("org.freedesktop.DBus.Error.NameHasNoOwner", message)
99 {}
100};
101
102struct DXXAPI ErrorNoReply : public Error
103{
105 : Error("org.freedesktop.DBus.Error.NoReply", message)
106 {}
107};
108
109struct DXXAPI ErrorIOError : public Error
110{
112 : Error("org.freedesktop.DBus.Error.IOError", message)
113 {}
114};
115
117{
119 : Error("org.freedesktop.DBus.Error.BadAddress", message)
120 {}
121};
122
124{
126 : Error("org.freedesktop.DBus.Error.NotSupported", message)
127 {}
128};
129
131{
133 : Error("org.freedesktop.DBus.Error.LimitsExceeded", message)
134 {}
135};
136
138{
140 : Error("org.freedesktop.DBus.Error.AccessDenied", message)
141 {}
142};
143
145{
147 : Error("org.freedesktop.DBus.Error.AuthFailed", message)
148 {}
149};
150
152{
154 : Error("org.freedesktop.DBus.Error.NoServer", message)
155 {}
156};
157
158struct DXXAPI ErrorTimeout : public Error
159{
161 : Error("org.freedesktop.DBus.Error.Timeout", message)
162 {}
163};
164
166{
168 : Error("org.freedesktop.DBus.Error.NoNetwork", message)
169 {}
170};
171
173{
175 : Error("org.freedesktop.DBus.Error.AddressInUse", message)
176 {}
177};
178
180{
182 : Error("org.freedesktop.DBus.Error.Disconnected", message)
183 {}
184};
185
187{
189 : Error("org.freedesktop.DBus.Error.InvalidArgs", message)
190 {}
191};
192
194{
196 : Error("org.freedesktop.DBus.Error.FileNotFound", message)
197 {}
198};
199
201{
203 : Error("org.freedesktop.DBus.Error.UnknownMethod", message)
204 {}
205};
206
208{
210 : Error("org.freedesktop.DBus.Error.TimedOut", message)
211 {}
212};
213
215{
217 : Error("org.freedesktop.DBus.Error.MatchRuleNotFound", message)
218 {}
219};
220
222{
224 : Error("org.freedesktop.DBus.Error.MatchRuleInvalid", message)
225 {}
226};
227
229{
231 : Error("org.freedesktop.DBus.Error.Spawn.ExecFailed", message)
232 {}
233};
234
236{
238 : Error("org.freedesktop.DBus.Error.Spawn.ForkFailed", message)
239 {}
240};
241
243{
245 : Error("org.freedesktop.DBus.Error.Spawn.ChildExited", message)
246 {}
247};
248
250{
252 : Error("org.freedesktop.DBus.Error.Spawn.ChildSignaled", message)
253 {}
254};
255
257{
259 : Error("org.freedesktop.DBus.Error.Spawn.Failed", message)
260 {}
261};
262
264{
266 : Error("org.freedesktop.DBus.Error.InvalidSignature", message)
267 {}
268};
269
271{
273 : Error("org.freedesktop.DBus.Error.UnixProcessIdUnknown", message)
274 {}
275};
276
278{
280 : Error("org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", message)
281 {}
282};
283
284} /* namespace DBus */
285
286#endif//__DBUSXX_ERROR_H
#define DXXAPI
Definition api.h:36
void set(const char *name, const char *message)
Definition error.cpp:80
const char * name() const
Definition error.cpp:65
const char * what() const
Definition error.cpp:85
const char * message() const
Definition error.cpp:70
bool is_set() const
Definition error.cpp:75
RefPtrI< InternalError > _int
Definition error.h:71
ErrorAccessDenied(const char *message)
Definition error.h:139
ErrorAddressInUse(const char *message)
Definition error.h:174
ErrorAuthFailed(const char *message)
Definition error.h:146
ErrorBadAddress(const char *message)
Definition error.h:118
ErrorDisconnected(const char *message)
Definition error.h:181
ErrorFailed(const char *message)
Definition error.h:76
ErrorFileNotFound(const char *message)
Definition error.h:195
ErrorIOError(const char *message)
Definition error.h:111
ErrorInvalidArgs(const char *message)
Definition error.h:188
ErrorInvalidSignature(const char *message)
Definition error.h:265
ErrorLimitsExceeded(const char *message)
Definition error.h:132
ErrorMatchRuleInvalid(const char *message)
Definition error.h:223
ErrorMatchRuleNotFound(const char *message)
Definition error.h:216
ErrorNameHasNoOwner(const char *message)
Definition error.h:97
ErrorNoMemory(const char *message)
Definition error.h:83
ErrorNoNetwork(const char *message)
Definition error.h:167
ErrorNoReply(const char *message)
Definition error.h:104
ErrorNoServer(const char *message)
Definition error.h:153
ErrorNotSupported(const char *message)
Definition error.h:125
ErrorSELinuxSecurityContextUnknown(const char *message)
Definition error.h:279
ErrorServiceUnknown(const char *message)
Definition error.h:90
ErrorSpawnChildExited(const char *message)
Definition error.h:244
ErrorSpawnChildSignaled(const char *message)
Definition error.h:251
ErrorSpawnExecFailed(const char *message)
Definition error.h:230
ErrorSpawnFailed(const char *message)
Definition error.h:258
ErrorSpawnForkFailed(const char *message)
Definition error.h:237
ErrorTimedOut(const char *message)
Definition error.h:209
ErrorTimeout(const char *message)
Definition error.h:160
ErrorUnixProcessIdUnknown(const char *message)
Definition error.h:272
ErrorUnknownMethod(const char *message)
Definition error.h:202