Skip to content

Commit

Permalink
Log exception that is thrown by internet connection check
Browse files Browse the repository at this point in the history
  • Loading branch information
MorrisJobke committed Jul 26, 2016
1 parent 3b6bba0 commit 5da813f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion settings/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ public function __construct(array $urlParams=[]){
$c->query('URLGenerator'),
$c->query('Util'),
$c->query('L10N'),
$c->query('Checker')
$c->query('Checker'),
$c->query('Logger')
);
});

Expand Down
9 changes: 8 additions & 1 deletion settings/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
use OC_Util;
use OCP\IURLGenerator;
Expand All @@ -56,6 +57,8 @@ class CheckSetupController extends Controller {
private $l10n;
/** @var Checker */
private $checker;
/** @var ILogger */
private $logger;

/**
* @param string $AppName
Expand All @@ -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,
Expand All @@ -74,14 +78,16 @@ public function __construct($AppName,
IURLGenerator $urlGenerator,
\OC_Util $util,
IL10N $l10n,
Checker $checker) {
Checker $checker,
ILogger $logger) {
parent::__construct($AppName, $request);
$this->config = $config;
$this->clientService = $clientService;
$this->util = $util;
$this->urlGenerator = $urlGenerator;
$this->l10n = $l10n;
$this->checker = $checker;
$this->logger = $logger;
}

/**
Expand Down Expand Up @@ -118,6 +124,7 @@ private function isSiteReachable($sitename) {
$client->get($httpSiteName);
$client->get($httpsSiteName);
} catch (\Exception $e) {
$this->logger->logException($e, ['app' => 'internet_connection_check']);
return false;
}
return true;
Expand Down

0 comments on commit 5da813f

Please sign in to comment.