From 40a1899bd98ac418994321831f0b2e8bad5f1c94 Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Fri, 21 Sep 2012 23:32:52 +0200
Subject: [PATCH] Catch exceptions when updating an app

---
 lib/app.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/app.php b/lib/app.php
index 8c3016d780..288f82d054 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -622,7 +622,13 @@ class OC_App{
 			$installedVersion = $versions[$app];
 			if (version_compare($currentVersion, $installedVersion, '>')) {
 				OC_Log::write($app, 'starting app upgrade from '.$installedVersion.' to '.$currentVersion, OC_Log::DEBUG);
-				OC_App::updateApp($app);
+				try {
+					OC_App::updateApp($app);
+				}
+				catch (Exception $e) {
+					echo 'Failed to upgrade "'.$app.'". Exception="'.$e->getMessage().'"';
+					die;
+				}
 				OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
 			}
 		}
-- 
GitLab