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 #include "OCException.h"
23 std::string OC::OCException::reason(const OCStackResult sr)
29 case OC_STACK_RESOURCE_CREATED:
30 return "Resource Created";
31 case OC_STACK_RESOURCE_DELETED:
32 return "Resource Deleted";
33 case OC_STACK_INVALID_URI:
35 case OC_STACK_INVALID_IP:
37 case OC_STACK_INVALID_PORT:
38 return "Invalid Port";
39 case OC_STACK_INVALID_CALLBACK:
40 return "Invalid Callback";
41 case OC_STACK_INVALID_METHOD:
42 return "Invalid Method";
43 case OC_STACK_INVALID_QUERY:
44 return "Invalid Query";
45 case OC_STACK_INVALID_PARAM:
46 return "Invalid Parameter";
47 case OC_STACK_INVALID_OBSERVE_PARAM:
48 return "Invalid Observe Parameter";
49 case OC_STACK_NO_MEMORY:
51 case OC_STACK_COMM_ERROR:
52 return "Communication Error";
53 case OC_STACK_NOTIMPL:
54 return "Not Implemented";
55 case OC_STACK_NO_RESOURCE:
56 return "Resource Not Found";
57 case OC_STACK_RESOURCE_ERROR:
58 return "Resource Error";
59 case OC_STACK_SLOW_RESOURCE:
60 return "Slow Resource";
61 case OC_STACK_NO_OBSERVERS:
62 return "No Observers";
63 case OC_STACK_OBSERVER_NOT_FOUND:
64 return "Stack observer not found";
65 case OC_STACK_OBSERVER_NOT_ADDED:
66 return "Stack observer not added";
67 case OC_STACK_OBSERVER_NOT_REMOVED:
68 return "Stack observer not removed";
70 case OC_STACK_PRESENCE_STOPPED:
71 return "Stack presence stopped";
72 case OC_STACK_PRESENCE_DO_NOT_HANDLE:
73 return "Stack presence should not be handled";
75 case OC_STACK_INVALID_OPTION:
76 return "Invalid option";
77 case OC_STACK_MALFORMED_RESPONSE:
78 return "Malformed response";
80 return "General Fault";
83 return "Unknown Error";