IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ESException.h
Go to the documentation of this file.
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20 
21 
22 #ifndef EASY_SETUP_EXCEPTION_H
23 #define EASY_SETUP_EXCEPTION_H
24 
25 #include <string>
26 #include <octypes.h>
32 namespace OIC
33 {
34  namespace Service
35  {
36 
41  class ESException: public std::exception
42  {
43  public:
44 
48  ESException();
49 
55  explicit ESException(const std::string &what);
56 
60  explicit ESException(std::string &&what);
61 
62  virtual ~ESException() noexcept;
63 
68  virtual const char *what() const noexcept;
69 
70  private:
74  const std::string m_what;
75  };
76 
82  {
83  public:
84 
90  explicit ESPlatformException(OCStackResult reason);
91 
97 
102  std::string getReason() const;
103 
104  private:
105  OCStackResult m_reason;
106  };
107 
113  {
114  public:
120  explicit ESBadRequestException(const std::string& what);
124  explicit ESBadRequestException(std::string&& what);
125  };
126 
132  {
133  public:
139  explicit ESInvalidParameterException(const std::string& what);
143  explicit ESInvalidParameterException(std::string&& what);
144  };
145 
150  {
151  public:
157  explicit ESBadGetException(const std::string& what);
161  explicit ESBadGetException(std::string&& what);
162  };
163 
169  {
170  public:
176  explicit ESInvalidKeyException(const std::string& what);
180  explicit ESInvalidKeyException(std::string&& what);
181  };
182  }
183 }
184 
185 #endif // EASY_SETUP_EXCEPTION_H
virtual const char * what() const noexcept
Returns the exception description.
virtual ~ESException() noexcept
OCStackResult getReasonCode() const
Returns the reason.
ESInvalidKeyException(const std::string &what)
Constructs an exception with a description.
Thrown when getting value with wrong template parameter.
Definition: ESException.h:149
std::string getReason() const
This function returns description of the exception.
ESInvalidParameterException(const std::string &what)
Constructs an exception with a description.
ESPlatformException(OCStackResult reason)
Constructs an exception with a description.
The base exception class for resource encapsulation.
Definition: ESException.h:41
OCStackResult
Declares Stack Results & Errors.
Definition: octypes.h:1054
This file contains the definition, types and APIs for resource(s) be implemented. ...
ESBadRequestException(const std::string &what)
Constructs an exception with a description.
Thrown when OC layer returns an error.
Definition: ESException.h:81
Thrown when a parameter is not valid.
Definition: ESException.h:131
ESBadGetException(const std::string &what)
Constructs an exception with a description.
Thrown when a key is invalid.
Definition: ESException.h:168
Thrown when a request is not acceptable.
Definition: ESException.h:112
ESException()
Constructs an exception with an empty description.