From 97eebc5d00e81e63e2141cf26563454e87f13940 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 3 Nov 2022 12:22:52 +0100 Subject: [PATCH] Don't spam warnings when the repo is 404 Signed-off-by: Joas Schilling --- lib/Service/GithubAPIService.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Service/GithubAPIService.php b/lib/Service/GithubAPIService.php index 4f101a0..a0a6b07 100644 --- a/lib/Service/GithubAPIService.php +++ b/lib/Service/GithubAPIService.php @@ -422,7 +422,12 @@ public function request(?string $userId, string $endPoint, array $params = [], s } catch (ClientException | ServerException $e) { $responseBody = $e->getResponse()->getBody(); $parsedResponseBody = json_decode($responseBody, true); - $this->logger->warning('GitHub API error : ' . $e->getMessage(), ['response_body' => $responseBody, 'app' => Application::APP_ID]); + if ($e->getResponse()->getStatusCode() === 404) { + // Only log inaccessible github links as debug + $this->logger->debug('GitHub API error : ' . $e->getMessage(), ['response_body' => $responseBody, 'app' => Application::APP_ID]); + } else { + $this->logger->warning('GitHub API error : ' . $e->getMessage(), ['response_body' => $responseBody, 'app' => Application::APP_ID]); + } return [ 'error' => $e->getMessage(), 'body' => $parsedResponseBody,