1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH 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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef __INTEL_OCEXCEPTION_H_2014_07_10
22 #define __INTEL_OCEXCEPTION_H_2014_07_10
28 typedef std::runtime_error reflection_exception;
30 class OCException : public std::runtime_error
33 OCException(const std::string& msg, OCStackResult reason = OC_STACK_ERROR): std::runtime_error(msg), m_reason(reason) {}
40 case OC_STACK_INVALID_URI:
42 case OC_STACK_INVALID_IP:
44 case OC_STACK_INVALID_PORT:
45 return "Invalid Port";
46 case OC_STACK_INVALID_CALLBACK:
47 return "Invalid Callback";
48 case OC_STACK_INVALID_METHOD:
49 return "Invalid Method";
50 case OC_STACK_INVALID_QUERY:
51 return "Invalid Query";
52 case OC_STACK_INVALID_PARAM:
53 return "Invalid Param";
54 case OC_STACK_INVALID_OBSERVE_PARAM:
55 return "Invalid Observe Param";
56 case OC_STACK_NO_MEMORY:
58 case OC_STACK_COMM_ERROR:
59 return "Communication Error";
60 case OC_STACK_NOTIMPL:
61 return "Not Implemented";
62 case OC_STACK_NO_RESOURCE:
63 return "Resource Not Found";
64 case OC_STACK_RESOURCE_ERROR:
65 return "Resource Error";
66 case OC_STACK_SLOW_RESOURCE:
67 return "Slow Resource";
68 case OC_STACK_NO_OBSERVERS:
69 return "No Observers";
71 return "General Fault";
73 return "Unknown Error";
78 OCStackResult m_reason;