mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 14:23:17 -04:00
fix(setupcheck): Catch Throwables from setup checks and show them to the admin
This avoids letting a buggy setup check from an application crash the setupcheck system. The throwable is shown instead. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
3af954fcc8
commit
a0a957c961
1 changed files with 6 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ use OC\AppFramework\Bootstrap\Coordinator;
|
|||
use OCP\Server;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\ISetupCheckManager;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class SetupCheckManager implements ISetupCheckManager {
|
||||
|
|
@ -46,7 +47,11 @@ class SetupCheckManager implements ISetupCheckManager {
|
|||
/** @var ISetupCheck $setupCheckObject */
|
||||
$setupCheckObject = Server::get($setupCheck->getService());
|
||||
$this->logger->debug('Running check '.get_class($setupCheckObject));
|
||||
$setupResult = $setupCheckObject->run();
|
||||
try {
|
||||
$setupResult = $setupCheckObject->run();
|
||||
} catch (\Throwable $t) {
|
||||
$setupResult = SetupResult::error("An exception occured while running the setup check:\n$t");
|
||||
}
|
||||
$setupResult->setName($setupCheckObject->getName());
|
||||
$category = $setupCheckObject->getCategory();
|
||||
$results[$category] ??= [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue