[Account] - function getAccount fixed
authorAndrzej Popowski <a.popowski@samsung.com>
Fri, 13 Feb 2015 14:48:33 +0000 (15:48 +0100)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Fri, 13 Feb 2015 15:04:04 +0000 (16:04 +0100)
Change-Id: Ic303753a4fd292f38f7f14f1d209bb988554d997
Signed-off-by: Andrzej Popowski <a.popowski@samsung.com>
src/account/account_manager.cc
src/account/account_manager.h

index fc5250f16687f089b0339b60384b78912dedf2c6..88610c8679525c5e5a7d89361c3e3f785821ba5d 100644 (file)
@@ -166,7 +166,7 @@ void AccountManager::GetAccountsInfo(const std::string& application_id,
   }
 }
 
-bool AccountManager::GetAccountInfo(int account_id, picojson::object& out) {
+void AccountManager::GetAccountInfo(int account_id, picojson::object& out) {
   LoggerD("Enter");
 
   account_h account = NULL;
@@ -178,27 +178,31 @@ bool AccountManager::GetAccountInfo(int account_id, picojson::object& out) {
   if (ret != ACCOUNT_ERROR_NONE) {
     LoggerE("Failed to create account info");
     REPORT_ERROR(out, UnknownException(GetErrorMsg(ret)));
-    return false;
+    return;
   }
 
   ret = account_query_account_by_account_id(account_id, &account);
-  if (ret != ACCOUNT_ERROR_NONE) {
+  if (ACCOUNT_ERROR_RECORD_NOT_FOUND == ret) {
+    out["status"] = picojson::value("success");
+    out["result"] = picojson::value();
+    return;
+  } else if (ret != ACCOUNT_ERROR_NONE) {
     LoggerE("Failed to get account info");
     REPORT_ERROR(out, UnknownException(GetErrorMsg(ret)));
-    return false;
+    return;
   }
 
   picojson::object info;
   if (!ConvertAccountToObject(account, info)) {
     LoggerE("Failed to convert account_h into object");
     REPORT_ERROR(out, UnknownException("Unknown error occurs"));
-    return false;
+    return;
   }
 
   out["status"] = picojson::value("success");
   out["result"] = picojson::value(info);
 
-  return true;
+  return;
 }
 
 bool AccountManager::GetProviderInfo(const std::string& provider_id,
index 5148b320843ae3ddc0dc6f845b514bd367c2eaac..1309cf363a8c0af761832779154db97a24cdf05a 100644 (file)
@@ -29,7 +29,7 @@ class AccountManager {
  * If status is "success", then the result(picojson::value) will be stored in out["result"].
  * If status is "error", then the error(picojson::value) will be stored in out["error"].
  */
-  bool GetAccountInfo(int account_id, picojson::object& out);
+  void GetAccountInfo(int account_id, picojson::object& out);
 
  /* out["status"] = "success" or "error"
  * If status is "success", then the result(picojson::value) will be stored in out["result"].