From 819cecf045d2a936f8fe5e65ecae2879c559ce26 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Thu, 26 Jan 2023 19:21:13 -0100 Subject: [PATCH] use loggerinterface Signed-off-by: Maxence Lange --- .../lib/Controller/ShareAPIController.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 2daa31a6886bc..061aeedda1540 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -81,6 +81,9 @@ use OCP\Share\IManager; use OCP\Share\IShare; use OCP\UserStatus\IManager as IUserStatusManager; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; +use Psr\Log\LoggerInterface; /** * Class Share20OCS @@ -410,8 +413,7 @@ private function fixMissingDisplayName(array $shares, ?array $updatedDisplayName * @param bool $cacheOnly - do not reach LUS, get data from cache. * * @return array - * @psalm-suppress DeprecatedMethod - * @psalm-suppress UndefinedClass + * @throws ContainerExceptionInterface */ private function retrieveFederatedDisplayName(array $userIds, bool $cacheOnly = false): array { // check if gss is enabled and available @@ -422,9 +424,15 @@ private function retrieveFederatedDisplayName(array $userIds, bool $cacheOnly = } try { + /** + * @psalm-suppress UndefinedClass + */ $slaveService = Server::get(\OCA\GlobalSiteSelector\Service\SlaveService::class); - } catch (Exception $e) { - \OC::$server->getLogger()->logException($e); + } catch (\Throwable $e) { + Server::get(LoggerInterface::class)->error( + $e->getMessage(), + ['exception' => $e] + ); return []; }