Use a better error message and point the users to the support channels

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2016-11-09 09:10:32 +01:00
parent 825a403f9c
commit ef917ee9c8
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
2 changed files with 13 additions and 1 deletions

View File

@ -40,6 +40,7 @@
namespace OC;
use Doctrine\DBAL\Exception\TableExistsException;
use OC\App\CodeChecker\CodeChecker;
use OC\App\CodeChecker\EmptyCheck;
use OC\App\CodeChecker\PrivateCheck;
@ -561,7 +562,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 <a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer">support channels</a>.'
);
}
}
//run appinfo/install.php

View File

@ -149,6 +149,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()));