IOT-2539 Clean switch compiler warning 41/22741/4
authorGeorge Nash <george.nash@intel.com>
Mon, 9 Oct 2017 22:44:14 +0000 (15:44 -0700)
committerRick Bell <richard.s.bell@intel.com>
Wed, 11 Oct 2017 18:00:40 +0000 (18:00 +0000)
Remove the [-Wswitch] warning
OC_STACK_CONTINUE_OPERATION and OC_STACK_SERVICE_UNAVAILABLE
were not in the Swtich in OCException and were added.

Bug: https://jira.iotivity.org/browse/IOT-2539
Change-Id: Idcd4e325f666a5b38a468f22f598336622cd951f
Signed-off-by: George Nash <george.nash@intel.com>
resource/include/StringConstants.h
resource/src/OCException.cpp
resource/unittests/OCExceptionTest.cpp

index f4922f1..60dbc48 100644 (file)
@@ -126,6 +126,7 @@ namespace OC
         static const char INCONSISTENT_DB[]            = "Data in provisioning DB is inconsistent";
         static const char AUTHENTICATION_FAILURE[]     = "Authentication failure";
         static const char NOT_ALLOWED_OXM[]            = "Not allowed ownership transfer method";
+        static const char CONTINUE_OPERATION[]         = "Error happened but current operation should continue";
         static const char USER_DENIED_REQ[]            = "Request denied by User";
         static const char NOT_ACCEPTABLE[]             = "Request not acceptable";
         static const char PUBLISH_RESOURCE_FAILED[]    = "Publish Resource failure";
@@ -134,6 +135,7 @@ namespace OC
         static const char INTERNAL_SERVER_ERROR[]      = "Internal server error";
         static const char BAD_ENDPOINT[]               = "Bad Endpoint";
         static const char GATEWAY_TIMEOUT[]            = "Gateway Timeout";
+        static const char SERVICE_UNAVAILABLE[]        = "Service Unavailable";
     }
 
     namespace Error
index b3a3508..e96c375 100644 (file)
@@ -111,6 +111,8 @@ std::string OC::OCException::reason(const OCStackResult sr)
             return OC::Exception::AUTHENTICATION_FAILURE;
         case OC_STACK_NOT_ALLOWED_OXM:
             return OC::Exception::NOT_ALLOWED_OXM;
+        case OC_STACK_CONTINUE_OPERATION:
+            return OC::Exception::CONTINUE_OPERATION;
         case OC_STACK_USER_DENIED_REQ:
             return OC::Exception::USER_DENIED_REQ;
         case OC_STACK_NOT_ACCEPTABLE:
@@ -123,6 +125,8 @@ std::string OC::OCException::reason(const OCStackResult sr)
             return OC::Exception::BAD_ENDPOINT;
         case OC_STACK_GATEWAY_TIMEOUT:
             return OC::Exception::GATEWAY_TIMEOUT;
+        case OC_STACK_SERVICE_UNAVAILABLE:
+            return OC::Exception::SERVICE_UNAVAILABLE;
     }
 
     return OC::Exception::UNKNOWN_ERROR;
index 8241144..3c7cb92 100644 (file)
@@ -75,12 +75,14 @@ namespace OC
                 OC_STACK_INCONSISTENT_DB,
                 OC_STACK_AUTHENTICATION_FAILURE,
                 OC_STACK_NOT_ALLOWED_OXM,
+                OC_STACK_CONTINUE_OPERATION,
                 OC_STACK_USER_DENIED_REQ,
                 OC_STACK_NOT_ACCEPTABLE,
                 OC_STACK_FORBIDDEN_REQ,
                 OC_STACK_INTERNAL_SERVER_ERROR,
                 OC_STACK_BAD_ENDPOINT,
-                OC_STACK_GATEWAY_TIMEOUT
+                OC_STACK_GATEWAY_TIMEOUT,
+                OC_STACK_SERVICE_UNAVAILABLE
             };
 
             std::string resultMessages[]=
@@ -127,12 +129,14 @@ namespace OC
                 OC::Exception::INCONSISTENT_DB,
                 OC::Exception::AUTHENTICATION_FAILURE,
                 OC::Exception::NOT_ALLOWED_OXM,
+                OC::Exception::CONTINUE_OPERATION,
                 OC::Exception::USER_DENIED_REQ,
                 OC::Exception::NOT_ACCEPTABLE,
                 OC::Exception::FORBIDDEN_REQ,
                 OC::Exception::INTERNAL_SERVER_ERROR,
                 OC::Exception::BAD_ENDPOINT,
-                OC::Exception::GATEWAY_TIMEOUT
+                OC::Exception::GATEWAY_TIMEOUT,
+                OC::Exception::SERVICE_UNAVAILABLE
             };
             TEST(OCExceptionTest, ReasonCodeMatches)
             {