Skip to content

Commit a57c79a

Browse files
authored
Merge pull request #2209 from nextcloud/feature/reduce-logs-for-non-existent-circles
Enhancement: Reduce logs for non-existent circles
2 parents 1c16b71 + 8baa44b commit a57c79a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Helper/CircleHelper.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use OCA\Circles\Model\Member;
1313
use OCA\Circles\Model\Probes\CircleProbe;
1414
use OCP\App\IAppManager;
15+
use OCP\IL10N;
1516
use OCP\Server;
1617
use Psr\Log\LoggerInterface;
1718
use Throwable;
@@ -29,6 +30,7 @@ class CircleHelper {
2930
public function __construct(
3031
private LoggerInterface $logger,
3132
IAppManager $appManager,
33+
private IL10N $l10n,
3234
) {
3335
$this->circlesEnabled = $appManager->isEnabledForUser('circles');
3436
$this->circlesManager = null;
@@ -59,6 +61,10 @@ public function getCircleDisplayName(string $circleId, string $userId): string {
5961
$circle = $this->circlesManager->getCircle($circleId);
6062
return $circle ? ($circle->getDisplayName() ?: $circleId) : $circleId;
6163
} catch (Throwable $e) {
64+
if ($e->getCode() === 404) {
65+
return $this->l10n->t('Deleted circle %s.', [$circleId]);
66+
}
67+
6268
$this->logger->warning('Failed to get circle display name: ' . $e->getMessage(), [
6369
'circleId' => $circleId,
6470
'userId' => $userId

0 commit comments

Comments
 (0)