cynara: handle additional error codes from Cynara API 50/38350/1
authorRafal Krypa <r.krypa@samsung.com>
Fri, 17 Apr 2015 09:18:32 +0000 (11:18 +0200)
committerRafal Krypa <r.krypa@samsung.com>
Fri, 17 Apr 2015 09:18:32 +0000 (11:18 +0200)
These error codes appeared in Cynara API after security-manager was
integrated with it.

Change-Id: Iba495040bd8bbb9a879a0fd27e880bb7547ed583
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
src/common/cynara.cpp
src/common/include/cynara.h

index 29b06bc..14acb36 100644 (file)
@@ -212,12 +212,20 @@ static bool checkCynaraError(int result, const std::string &msg)
             return true;
         case CYNARA_API_ACCESS_DENIED:
             return false;
+        case CYNARA_API_MAX_PENDING_REQUESTS:
+            ThrowMsg(CynaraException::MaxPendingRequests, msg);
         case CYNARA_API_OUT_OF_MEMORY:
             ThrowMsg(CynaraException::OutOfMemory, msg);
         case CYNARA_API_INVALID_PARAM:
             ThrowMsg(CynaraException::InvalidParam, msg);
         case CYNARA_API_SERVICE_NOT_AVAILABLE:
             ThrowMsg(CynaraException::ServiceNotAvailable, msg);
+        case CYNARA_API_METHOD_NOT_SUPPORTED:
+            ThrowMsg(CynaraException::MethodNotSupported, msg);
+        case CYNARA_API_OPERATION_NOT_ALLOWED:
+            ThrowMsg(CynaraException::OperationNotAllowed, msg);
+        case CYNARA_API_OPERATION_FAILED:
+            ThrowMsg(CynaraException::OperationFailed, msg);
         case CYNARA_API_BUCKET_NOT_FOUND:
             ThrowMsg(CynaraException::BucketNotFound, msg);
         default:
index a75e414..3e9a818 100644 (file)
@@ -51,11 +51,15 @@ class CynaraException
 {
 public:
     DECLARE_EXCEPTION_TYPE(SecurityManager::Exception, Base)
+    DECLARE_EXCEPTION_TYPE(Base, MaxPendingRequests)
     DECLARE_EXCEPTION_TYPE(Base, OutOfMemory)
     DECLARE_EXCEPTION_TYPE(Base, InvalidParam)
     DECLARE_EXCEPTION_TYPE(Base, ServiceNotAvailable)
-    DECLARE_EXCEPTION_TYPE(Base, UnknownError)
+    DECLARE_EXCEPTION_TYPE(Base, MethodNotSupported)
+    DECLARE_EXCEPTION_TYPE(Base, OperationNotAllowed)
+    DECLARE_EXCEPTION_TYPE(Base, OperationFailed)
     DECLARE_EXCEPTION_TYPE(Base, BucketNotFound)
+    DECLARE_EXCEPTION_TYPE(Base, UnknownError)
 };
 
 struct CynaraAdminPolicy : cynara_admin_policy