Initial commit based on .zip from Glenn Schmottlach.
[dbus-cxx-async.git] / include / dbus-c++ / error.h
blobf50adae3f319afe488e83da97d0bc9dc7bd62009
1 /*
3 * D-Bus++ - C++ bindings for D-Bus
5 * Copyright (C) 2005-2009 Paolo Durante <shackan@gmail.com>
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.
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.
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
25 #ifndef __DBUSXX_ERROR_H
26 #define __DBUSXX_ERROR_H
28 #include "api.h"
29 #include "util.h"
31 #include <exception>
33 namespace DBus {
35 class Message;
36 class ErrorMessage;
37 class InternalError;
39 class DBUSXXAPI Error : public std::exception
41 public:
43 Error();
45 Error(InternalError &);
47 Error(const char *name, const char *description);
49 Error(Message &);
51 ~Error() throw();
53 const char *what() const throw();
55 const char *name() const;
57 const char *description() const;
59 void set(const ErrorMessage &error);
61 void set(const char *name, const char *description);
62 // parameters MUST be static strings
64 bool is_set() const;
66 operator bool() const
68 return is_set();
71 private:
73 RefPtrI<InternalError> _int;
76 struct DBUSXXAPI ErrorFailed : public Error
78 ErrorFailed(const char *description)
79 : Error("org.freedesktop.DBus.Error.Failed", description)
83 struct DBUSXXAPI ErrorNoMemory : public Error
85 ErrorNoMemory(const char *description)
86 : Error("org.freedesktop.DBus.Error.NoMemory", description)
90 struct DBUSXXAPI ErrorServiceUnknown : public Error
92 ErrorServiceUnknown(const char *description)
93 : Error("org.freedesktop.DBus.Error.ServiceUnknown", description)
97 struct DBUSXXAPI ErrorNameHasNoOwner : public Error
99 ErrorNameHasNoOwner(const char *description)
100 : Error("org.freedesktop.DBus.Error.NameHasNoOwner", description)
104 struct DBUSXXAPI ErrorNoReply : public Error
106 ErrorNoReply(const char *description)
107 : Error("org.freedesktop.DBus.Error.NoReply", description)
111 struct DBUSXXAPI ErrorIOError : public Error
113 ErrorIOError(const char *description)
114 : Error("org.freedesktop.DBus.Error.IOError", description)
118 struct DBUSXXAPI ErrorBadAddress : public Error
120 ErrorBadAddress(const char *description)
121 : Error("org.freedesktop.DBus.Error.BadAddress", description)
125 struct DBUSXXAPI ErrorNotSupported : public Error
127 ErrorNotSupported(const char *description)
128 : Error("org.freedesktop.DBus.Error.NotSupported", description)
132 struct DBUSXXAPI ErrorLimitsExceeded : public Error
134 ErrorLimitsExceeded(const char *description)
135 : Error("org.freedesktop.DBus.Error.LimitsExceeded", description)
139 struct DBUSXXAPI ErrorAccessDenied : public Error
141 ErrorAccessDenied(const char *description)
142 : Error("org.freedesktop.DBus.Error.AccessDenied", description)
146 struct DBUSXXAPI ErrorAuthFailed : public Error
148 ErrorAuthFailed(const char *description)
149 : Error("org.freedesktop.DBus.Error.AuthFailed", description)
153 struct DBUSXXAPI ErrorNoServer : public Error
155 ErrorNoServer(const char *description)
156 : Error("org.freedesktop.DBus.Error.NoServer", description)
160 struct DBUSXXAPI ErrorTimeout : public Error
162 ErrorTimeout(const char *description)
163 : Error("org.freedesktop.DBus.Error.Timeout", description)
167 struct DBUSXXAPI ErrorNoNetwork : public Error
169 ErrorNoNetwork(const char *description)
170 : Error("org.freedesktop.DBus.Error.NoNetwork", description)
174 struct DBUSXXAPI ErrorAddressInUse : public Error
176 ErrorAddressInUse(const char *description)
177 : Error("org.freedesktop.DBus.Error.AddressInUse", description)
181 struct DBUSXXAPI ErrorDisconnected : public Error
183 ErrorDisconnected(const char *description)
184 : Error("org.freedesktop.DBus.Error.Disconnected", description)
188 struct DBUSXXAPI ErrorInvalidArgs : public Error
190 ErrorInvalidArgs(const char *description)
191 : Error("org.freedesktop.DBus.Error.InvalidArgs", description)
195 struct DBUSXXAPI ErrorFileNotFound : public Error
197 ErrorFileNotFound(const char *description)
198 : Error("org.freedesktop.DBus.Error.FileNotFound", description)
202 struct DBUSXXAPI ErrorUnknownMethod : public Error
204 ErrorUnknownMethod(const char *description)
205 : Error("org.freedesktop.DBus.Error.UnknownMethod", description)
209 struct DBUSXXAPI ErrorTimedOut : public Error
211 ErrorTimedOut(const char *description)
212 : Error("org.freedesktop.DBus.Error.TimedOut", description)
216 struct DBUSXXAPI ErrorMatchRuleNotFound : public Error
218 ErrorMatchRuleNotFound(const char *description)
219 : Error("org.freedesktop.DBus.Error.MatchRuleNotFound", description)
223 struct DBUSXXAPI ErrorMatchRuleInvalid : public Error
225 ErrorMatchRuleInvalid(const char *description)
226 : Error("org.freedesktop.DBus.Error.MatchRuleInvalid", description)
230 struct DBUSXXAPI ErrorSpawnExecFailed : public Error
232 ErrorSpawnExecFailed(const char *description)
233 : Error("org.freedesktop.DBus.Error.Spawn.ExecFailed", description)
237 struct DBUSXXAPI ErrorSpawnForkFailed : public Error
239 ErrorSpawnForkFailed(const char *description)
240 : Error("org.freedesktop.DBus.Error.Spawn.ForkFailed", description)
244 struct DBUSXXAPI ErrorSpawnChildExited : public Error
246 ErrorSpawnChildExited(const char *description)
247 : Error("org.freedesktop.DBus.Error.Spawn.ChildExited", description)
251 struct DBUSXXAPI ErrorSpawnChildSignaled : public Error
253 ErrorSpawnChildSignaled(const char *description)
254 : Error("org.freedesktop.DBus.Error.Spawn.ChildSignaled", description)
258 struct DBUSXXAPI ErrorSpawnFailed : public Error
260 ErrorSpawnFailed(const char *description)
261 : Error("org.freedesktop.DBus.Error.Spawn.Failed", description)
265 struct DBUSXXAPI ErrorInvalidSignature : public Error
267 ErrorInvalidSignature(const char *description)
268 : Error("org.freedesktop.DBus.Error.InvalidSignature", description)
272 struct DBUSXXAPI ErrorUnixProcessIdUnknown : public Error
274 ErrorUnixProcessIdUnknown(const char *description)
275 : Error("org.freedesktop.DBus.Error.UnixProcessIdUnknown", description)
279 struct DBUSXXAPI ErrorSELinuxSecurityContextUnknown : public Error
281 ErrorSELinuxSecurityContextUnknown(const char *description)
282 : Error("org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", description)
286 } /* namespace DBus */
288 #endif//__DBUSXX_ERROR_H