Cynara: Change the type of exception in CynaraAdminPolicy constructors 77/24577/2
authorMarcin Lis <m.lis@samsung.com>
Wed, 16 Jul 2014 14:54:59 +0000 (16:54 +0200)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Fri, 18 Jul 2014 20:06:13 +0000 (13:06 -0700)
It is better to keep exception types unified. That would minimize the number of
"catch" statements.

Change-Id: Id9e5bafef70c7ffb126a60c595505b644d596729
Signed-off-by: Marcin Lis <m.lis@samsung.com>
src/server/service/cynara.cpp

index 7b1dbb8..2cf3f19 100644 (file)
@@ -44,7 +44,8 @@ CynaraAdminPolicy::CynaraAdminPolicy(const std::string &client, const std::strin
         free(this->client);
         free(this->user);
         free(this->privilege);
-        throw std::bad_alloc();
+        ThrowMsg(CynaraException::OutOfMemory,
+                std::string("Error in CynaraAdminPolicy allocation."));
     }
 
     this->result = static_cast<int>(operation);
@@ -70,7 +71,8 @@ CynaraAdminPolicy::CynaraAdminPolicy(const std::string &client, const std::strin
         free(this->user);
         free(this->privilege);
         free(this->result_extra);
-        throw std::bad_alloc();
+        ThrowMsg(CynaraException::OutOfMemory,
+                std::string("Error in CynaraAdminPolicy allocation."));
     }
 }