9551a5ac64751cf7dbf37b5c92dcbb40ceaa4bbe
[platform/upstream/iotivity.git] / service / easy-setup / sdk / mediator / src / ESException.cpp
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 #include "ESException.h"
22
23 #include "OCException.h"
24
25 namespace OIC
26 {
27     namespace Service
28     {
29
30         ESException::ESException()
31         {
32         }
33
34         ESException::ESException(const std::string& what) :
35                 m_what{ what }
36         {
37         }
38
39         ESException::ESException(std::string&& what) :
40                 m_what{ std::move(what) }
41         {
42         }
43
44         ESException::~ESException() noexcept
45         {
46         }
47
48         const char* ESException::what() const noexcept
49         {
50             return m_what.c_str();
51         }
52
53
54         ESPlatformException::ESPlatformException(OCStackResult reason) :
55                 ESException{ "Failed : " + OC::OCException::reason(reason) },
56                 m_reason { reason }
57         {
58         }
59
60         OCStackResult ESPlatformException::getReasonCode() const
61         {
62             return m_reason;
63         }
64
65         std::string ESPlatformException::getReason() const
66         {
67             return  OC::OCException::reason(m_reason);
68         }
69
70
71         ESBadRequestException::ESBadRequestException(const std::string& what) :
72                 ESException{ what }
73         {
74         }
75
76         ESBadRequestException::ESBadRequestException(std::string&& what) :
77                 ESException{ std::move(what) }
78         {
79         }
80
81
82         ESInvalidParameterException::ESInvalidParameterException(const std::string& what) :
83                 ESException{ what }
84         {
85         }
86
87         ESInvalidParameterException::ESInvalidParameterException(std::string&& what) :
88                 ESException{ std::move(what) }
89         {
90         }
91
92
93         ESBadGetException::ESBadGetException(const std::string& what) :
94                 ESException{ what }
95         {
96         }
97
98         ESBadGetException::ESBadGetException(std::string&& what) :
99                 ESException{ std::move(what) }
100         {
101         }
102
103
104         ESInvalidKeyException::ESInvalidKeyException(const std::string& what) :
105                 ESException{ what }
106         {
107         }
108
109         ESInvalidKeyException::ESInvalidKeyException(std::string&& what) :
110                 ESException{ std::move(what) }
111         {
112         }
113     }
114 }