correct error definition when to-be-uninstalled widget is running
[framework/web/wrt-installer.git] / src / jobs / widget_uninstall / task_check.cpp
index d2ae728..aac218b 100644 (file)
@@ -38,8 +38,7 @@ TaskCheck::TaskCheck(UninstallerContext& context) :
 }
 
 TaskCheck::~TaskCheck()
-{
-}
+{}
 
 void TaskCheck::StepUninstallPreCheck()
 {
@@ -47,9 +46,8 @@ void TaskCheck::StepUninstallPreCheck()
     //check if deferred
     //TODO if widget to be updated, then remove it from Deferred list?
 
-    int ret = APP_MANAGER_ERROR_NONE;
     bool isRunning = false;
-    ret = app_manager_is_running(m_context.tzAppid.c_str(), &isRunning);
+    int ret = app_manager_is_running(m_context.tzAppid.c_str(), &isRunning);
     if (APP_MANAGER_ERROR_NONE != ret) {
         LogError("Fail to get running state");
         ThrowMsg(Exceptions::PlatformAPIFailure,
@@ -58,16 +56,13 @@ void TaskCheck::StepUninstallPreCheck()
 
     if (true == isRunning) {
         LogError("Widget is not stopped. Cannot uninstall!");
-        //TODO different error
-        ThrowMsg(Exceptions::AlreadyUninstalling,
+        ThrowMsg(Exceptions::AppIsRunning,
                  "Widget is not stopped. Cannot uninstall!");
-        //TODO or defer uninstall?
     }
 
     LogInfo("Widget Can be uninstalled. Pkgname : " << m_context.tzAppid);
     m_context.job->UpdateProgress(UninstallerContext::UNINSTALL_PRECHECK,
                                   "Uninstall pre-checking Finished");
 }
-
 } //namespace WidgetUninstall
 } //namespace Jobs