From 5da813f477a9458a523c5470c2d18f2afb97af86 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 26 Jul 2016 10:03:31 +0200 Subject: [PATCH] Log exception that is thrown by internet connection check --- settings/Application.php | 3 ++- settings/Controller/CheckSetupController.php | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/settings/Application.php b/settings/Application.php index 657b3fe490a..6db5e2aabf6 100644 --- a/settings/Application.php +++ b/settings/Application.php @@ -174,7 +174,8 @@ class Application extends App { $c->query('URLGenerator'), $c->query('Util'), $c->query('L10N'), - $c->query('Checker') + $c->query('Checker'), + $c->query('Logger') ); }); diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php index bfb83e91936..13e7e443621 100644 --- a/settings/Controller/CheckSetupController.php +++ b/settings/Controller/CheckSetupController.php @@ -36,6 +36,7 @@ use OCP\AppFramework\Http\RedirectResponse; use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\IL10N; +use OCP\ILogger; use OCP\IRequest; use OC_Util; use OCP\IURLGenerator; @@ -56,6 +57,8 @@ class CheckSetupController extends Controller { private $l10n; /** @var Checker */ private $checker; + /** @var ILogger */ + private $logger; /** * @param string $AppName @@ -66,6 +69,7 @@ class CheckSetupController extends Controller { * @param \OC_Util $util * @param IL10N $l10n * @param Checker $checker + * @param ILogger $logger */ public function __construct($AppName, IRequest $request, @@ -74,7 +78,8 @@ class CheckSetupController extends Controller { IURLGenerator $urlGenerator, \OC_Util $util, IL10N $l10n, - Checker $checker) { + Checker $checker, + ILogger $logger) { parent::__construct($AppName, $request); $this->config = $config; $this->clientService = $clientService; @@ -82,6 +87,7 @@ class CheckSetupController extends Controller { $this->urlGenerator = $urlGenerator; $this->l10n = $l10n; $this->checker = $checker; + $this->logger = $logger; } /** @@ -118,6 +124,7 @@ class CheckSetupController extends Controller { $client->get($httpSiteName); $client->get($httpsSiteName); } catch (\Exception $e) { + $this->logger->logException($e, ['app' => 'internet_connection_check']); return false; } return true; -- 2.39.5