Skip to content

Commit

Permalink
Removed unnecessary lines and added error reporting
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Klinger <florian.klinger@nextcloud.com>
  • Loading branch information
nc-fkl authored and julien-nc committed Jan 23, 2024
1 parent 62d17c2 commit ee13ccd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use OCP\Http\Client\IClientService;
use OCP\IRequest;
use OCP\Security\ICrypto;
use Psr\Log\LoggerInterface;

class SettingsController extends Controller {

Expand All @@ -51,14 +52,17 @@ class SettingsController extends Controller {
private $crypto;
/** @var IClientService */
private $clientService;
/** @var LoggerInterface */
private $logger;

public function __construct(
IRequest $request,
ProviderMapper $providerMapper,
ID4MeService $id4meService,
ProviderService $providerService,
ICrypto $crypto,
IClientService $clientService
IClientService $clientService,
LoggerInterface $logger
) {
parent::__construct(Application::APP_ID, $request);

Expand All @@ -67,6 +71,7 @@ public function __construct(
$this->providerService = $providerService;
$this->crypto = $crypto;
$this->clientService = $clientService;
$this->logger = $logger;
}

public function isDiscoveryEndpointValid($url) {
Expand Down Expand Up @@ -97,12 +102,9 @@ public function isDiscoveryEndpointValid($url) {
$result['missingFields'][] = $field;
}
}
} else {
// Set isReachable to false if http code wasn't 200
$result['isReachable'] = false;
}
} catch (Exception $e) {
$result['isReachable'] = false;
$this->logger->error('Error - discovery endpoint validation: ' . $e);
}

return $result;
Expand Down

0 comments on commit ee13ccd

Please sign in to comment.