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 <[email protected]>
  • Loading branch information
nc-fkl committed Jan 5, 2024
1 parent 31db1a2 commit 50e9a29
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use OCP\IRequest;
use OCP\Security\ICrypto;
use OCP\Http\Client\IClientService;
use Psr\Log\LoggerInterface;

class SettingsController extends Controller {

Expand All @@ -51,22 +52,26 @@ class SettingsController extends Controller {
private $crypto;
/** @var IClientService */
private $clientService;
/** @var ILogger */
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);

$this->providerMapper = $providerMapper;
$this->id4meService = $id4meService;
$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 50e9a29

Please sign in to comment.