tizen 2.4 release
[framework/web/wrt-installer.git] / src / logic / installer_logic.cpp
similarity index 90%
rename from src_wearable/logic/installer_logic.cpp
rename to src/logic/installer_logic.cpp
index b80c98b..27c126d 100755 (executable)
@@ -24,7 +24,8 @@
 #include <plugin_install/job_plugin_install.h>
 #include <job_exception_base.h>
 #include <plugin_install/plugin_objects.h>
-#include <installer_log.h>
+#include <dpl/log/secure_log.h>
+#include <widget_install/widget_install_errors.h>
 
 using namespace WrtDB;
 
@@ -172,9 +173,28 @@ bool InstallerLogic::NextStep(Jobs::Job *job)
         return false;
     } catch (Jobs::JobExceptionBase &exc) {
         //start revert job
-        _D("Exception occured: %d. Reverting job...", exc.getParam());
+        _E("Exception occured: %s(%d). Reverting job...", exc.GetMessage().c_str(), exc.getParam());
+
+        bool hasAbortSteps = job->Abort();
+        job->SetAbortStarted(true);
+        job->SaveExceptionData(exc);
+
+        if (!hasAbortSteps) {
+            //no AbortSteps
+            job->SendFinishedFailure();
+
+            //clean job
+            delete job;
+            m_job=0;
+        }
+        return hasAbortSteps;
+    } catch (...) {
+        _E("Uncaught exception occured");
         bool hasAbortSteps = job->Abort();
         job->SetAbortStarted(true);
+
+        Jobs::WidgetInstall::Exceptions::UncaughtException exc(
+            "unknown", "unknown", 0, std::string("uncaught exception occured"));
         job->SaveExceptionData(exc);
 
         if (!hasAbortSteps) {
@@ -195,6 +215,7 @@ bool InstallerLogic::AbortJob(const Jobs::JobHandle & /*handle*/)
     _W("Not implemented");
     return true;
 }
+
 void InstallerLogic::InstallWaitingPlugins()
 {
     PluginHandleSetPtr waitingPlugins;