log failures to read certificates during listing

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2023-05-25 17:03:18 +02:00 committed by Arthur Schiwon
parent 7073c21e2d
commit 6d881c10e8

View file

@ -83,8 +83,14 @@ class CertificateManager implements ICertificateManager {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
try {
$result[] = new Certificate($this->view->file_get_contents($path . $file), $file);
$content = $this->view->file_get_contents($path . $file);
if ($content !== false) {
$result[] = new Certificate($content, $file);
} else {
$this->logger->error("Failed to read certificate from $path");
}
} catch (\Exception $e) {
$this->logger->error("Failed to read certificate from $path", ['exception' => $e]);
}
}
}