diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-11-09 13:59:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-09 13:59:33 +0100 |
commit | 742c215946555371b2ae1e855cefa65e5cc712a3 (patch) | |
tree | 8bbf3760c420d640aff017b3ca9199bc2fa52098 | |
parent | eadccc239a91490e1165dcc5a94c8c4845a3f66a (diff) | |
parent | 2f7e291101a5fd2b3f149d0b62fc5f3663115d2b (diff) | |
download | nextcloud-server-742c215946555371b2ae1e855cefa65e5cc712a3.tar.gz nextcloud-server-742c215946555371b2ae1e855cefa65e5cc712a3.zip |
Merge pull request #2058 from nextcloud/better-error-message-for-installation-error
Use a better error message and point the users to the support channels
-rw-r--r-- | lib/private/Installer.php | 20 | ||||
-rw-r--r-- | lib/private/Updater.php | 4 |
2 files changed, 20 insertions, 4 deletions
diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 2366b762654..aff2d2194aa 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; @@ -428,9 +429,12 @@ class Installer { if ($softErrors) { try { Installer::installShippedApp($filename); - } catch (\Doctrine\DBAL\Exception\TableExistsException $e) { - $errors[$filename] = $e; - continue; + } catch (HintException $e) { + if ($e->getPrevious() instanceof TableExistsException) { + $errors[$filename] = $e; + continue; + } + throw $e; } } else { Installer::installShippedApp($filename); @@ -457,7 +461,15 @@ 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 <a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer">support channels</a>.', + 0, $e + ); + } } //run appinfo/install.php diff --git a/lib/private/Updater.php b/lib/private/Updater.php index e7f7a944902..2fed67988b8 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())); |