From 224dfaf1e60ce9c6493ffb0449bdfcca5f31ec29 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 9 Nov 2016 09:10:32 +0100 Subject: [PATCH] Use a better error message and point the users to the support channels Signed-off-by: Joas Schilling --- lib/private/Installer.php | 10 +++++++++- lib/private/Updater.php | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 2366b76265..fdfa44c143 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -41,6 +41,7 @@ namespace OC; +use Doctrine\DBAL\Exception\TableExistsException; use OC\App\AppStore\Fetcher\AppFetcher; use OC\App\CodeChecker\CodeChecker; use OC\App\CodeChecker\EmptyCheck; @@ -457,7 +458,14 @@ class Installer { //install the database $appPath = OC_App::getAppPath($app); if(is_file("$appPath/appinfo/database.xml")) { - OC_DB::createDbFromStructure("$appPath/appinfo/database.xml"); + try { + OC_DB::createDbFromStructure("$appPath/appinfo/database.xml"); + } catch (TableExistsException $e) { + throw new HintException( + 'Failed to enable app ' . $app, + 'Please ask for help via one of our support channels.' + ); + } } //run appinfo/install.php diff --git a/lib/private/Updater.php b/lib/private/Updater.php index e7f7a94490..2fed67988b 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -121,6 +121,10 @@ class Updater extends BasicEmitter { $success = true; try { $this->doUpgrade($currentVersion, $installedVersion); + } catch (HintException $exception) { + $this->log->logException($exception, ['app' => 'core']); + $this->emit('\OC\Updater', 'failure', array($exception->getMessage() . ': ' .$exception->getHint())); + $success = false; } catch (\Exception $exception) { $this->log->logException($exception, ['app' => 'core']); $this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage()));