Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\PreConditionNotMetException;
use Psr\Log\LoggerInterface;

class ConfigController extends Controller {

Expand All @@ -35,6 +36,7 @@ public function __construct(
private IURLGenerator $urlGenerator,
private IL10N $l,
private IInitialState $initialStateService,
private LoggerInterface $logger,
private GithubAPIService $githubAPIService,
private SecretService $secretService,
private GithubIssuePrReferenceProvider $githubIssuePrReferenceProvider,
Expand Down Expand Up @@ -202,6 +204,7 @@ public function oauthRedirect(string $code, string $state): RedirectResponse {
}
}
$result = $this->l->t('Error getting OAuth access token');
$this->logger->warning('No access token in the token request response', ['response' => $result]);
} else {
$result = $this->l->t('Error during OAuth exchanges');
}
Expand Down
10 changes: 5 additions & 5 deletions lib/Service/GithubAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,16 @@ public function request(?string $userId, string $endPoint, array $params = [], s
$parsedResponseBody = json_decode($responseBody, true);
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]);
$this->logger->debug('GitHub API client or server error', ['response_body' => $responseBody, 'exception' => $e]);
} else {
$this->logger->warning('GitHub API error : ' . $e->getMessage(), ['response_body' => $responseBody, 'app' => Application::APP_ID]);
$this->logger->warning('GitHub API client or server error', ['response_body' => $responseBody, 'exception' => $e]);
}
return [
'error' => $e->getMessage(),
'body' => $parsedResponseBody,
];
} catch (Exception|Throwable $e) {
$this->logger->warning('GitHub API error : ' . $e->getMessage(), ['app' => Application::APP_ID]);
$this->logger->warning('GitHub API request error', ['exception' => $e]);
return ['error' => $e->getMessage()];
}
}
Expand Down Expand Up @@ -455,7 +455,7 @@ public function revokeOauthToken(string $userId): array {
return [];
}
} catch (Exception $e) {
$this->logger->warning('GitHub API error : ' . $e->getMessage(), ['app' => Application::APP_ID]);
$this->logger->warning('GitHub API revoke token error', ['exception' => $e]);
return ['error' => $e->getMessage()];
}
}
Expand Down Expand Up @@ -505,7 +505,7 @@ public function requestOAuthAccessToken(array $params = [], string $method = 'GE
return $resultArray;
}
} catch (Exception $e) {
$this->logger->warning('GitHub OAuth error : ' . $e->getMessage(), ['app' => Application::APP_ID]);
$this->logger->warning('GitHub OAuth access token request error', ['exception' => $e]);
return ['error' => $e->getMessage()];
}
}
Expand Down
Loading