Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ScopeExceptions.h
1 /*
2  * Copyright (C) 2013 Canonical Ltd
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Michi Henning <michi.henning@canonical.com>
17  */
18 
19 #ifndef UNITY_SCOPES_SCOPEEXCEPTIONS_H
20 #define UNITY_SCOPES_SCOPEEXCEPTIONS_H
21 
22 #include <unity/Exception.h>
23 
24 namespace unity
25 {
26 
27 namespace scopes
28 {
29 
34 class MiddlewareException : public virtual unity::Exception
35 {
36 public:
41  explicit MiddlewareException(std::string const& reason);
42 
46  //{@
48  MiddlewareException& operator=(MiddlewareException const&);
50 
52  virtual ~MiddlewareException();
54 
59  virtual std::exception_ptr self() const override;
60 };
61 
68 {
69 public:
75  explicit ObjectNotExistException(std::string const& reason, std::string const& id);
76 
80  //{@
84 
86  virtual ~ObjectNotExistException() noexcept;
88 
93  virtual std::exception_ptr self() const override;
94 
99  virtual std::string id() const;
100 
101 private:
102  std::string id_;
103 };
104 
109 class TimeoutException : public virtual MiddlewareException
110 {
111 public:
116  explicit TimeoutException(std::string const& reason);
117 
121  //{@
123  TimeoutException& operator=(TimeoutException const&);
125 
127  virtual ~TimeoutException() noexcept;
129 
134  virtual std::exception_ptr self() const override;
135 };
136 
141 class ConfigException : public virtual unity::Exception
142 {
143 public:
148  explicit ConfigException(std::string const& reason);
149 
153  //{@
155  ConfigException& operator=(ConfigException const&);
157 
159  virtual ~ConfigException();
161 
166  virtual std::exception_ptr self() const override;
167 };
168 
173 class NotFoundException : public virtual unity::Exception
174 {
175 public:
181  explicit NotFoundException(std::string const& reason, std::string const& name);
182 
186  //{@
188  NotFoundException& operator=(NotFoundException const&);
190 
192  virtual ~NotFoundException();
194 
199  virtual std::exception_ptr self() const override;
200 
205  virtual std::string name() const;
206 
207 private:
208  std::string name_;
209 };
210 
211 } // namespace scopes
212 
213 } // namespace unity
214 
215 #endif
virtual std::string id() const
Returns the identity of the non-existent object.
Definition: ScopeExceptions.cpp:75
NotFoundException(std::string const &reason, std::string const &name)
Constructs the exception.
Definition: ScopeExceptions.cpp:125
Exception to indicate that something went wrong with the middleware layer.
Definition: ScopeExceptions.h:34
virtual std::string name() const
Returns the name that was passed to the constructor.
Definition: ScopeExceptions.cpp:148
Exception to indicate that something went wrong with the contents of configuration files...
Definition: ScopeExceptions.h:141
TimeoutException(std::string const &reason)
Constructs the exception.
Definition: ScopeExceptions.cpp:80
Exception to indicate that an object wasn't found by a lookup function.
Definition: ScopeExceptions.h:173
MiddlewareException(std::string const &reason)
Constructs the exception.
Definition: ScopeExceptions.cpp:29
ObjectNotExistException(std::string const &reason, std::string const &id)
Constructs the exception.
Definition: ScopeExceptions.cpp:50
Exception to indicate that a twoway request timed out.
Definition: ScopeExceptions.h:109
Exception to indicate that a (twoway) request was sent to an object with an unknown identity...
Definition: ScopeExceptions.h:67
ConfigException(std::string const &reason)
Constructs the exception.
Definition: ScopeExceptions.cpp:102