1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 * This file defines a class to handle exception thrown for resource encapsulation.
27 #ifndef RES_ENCAPSULATION_RCSEXCEPTION_H
28 #define RES_ENCAPSULATION_RCSEXCEPTION_H
41 * @brief This class helps to throw wide range of exception to the application/developers.
42 * It inherits the standard exception class.
45 class RCSException: public std::exception
54 * Parametrized Constructor to set exception description as a string.
56 * @param what - exception description
58 explicit RCSException(const std::string &what);
61 * Parametrized Constructor to set exception description as a string.
63 * @param what - exception description
65 explicit RCSException(std::string &&what);
70 virtual ~RCSException() noexcept {}
73 * API for returning the exception description in string format
75 * @return const char* - exception description
77 virtual const char *what() const noexcept;
81 * Exception description
87 * @class PlatformException
88 * @brief This class helps in throwing platform exception to the application/developers.
89 * It inherits from RCSException class.
91 * NOTE: OCStackResult is defined in octypes.h.
93 class PlatformException: public RCSException
96 explicit PlatformException(OCStackResult reason);
99 * API for getting exception code.
101 * @return OCStackResult - exception code.
104 OCStackResult getReasonCode() const;
106 * API for getting exception reason.
108 * @return string - exception reason as a string.
111 std::string getReason() const;
115 * reason for the exception, stored as OCStackResult value.
117 OCStackResult m_reason;
122 #endif // RES_ENCAPSULATION_RCSEXCEPTION_H