MCPcopy Create free account
hub / github.com/Rello/analytics / getHttpErrorMessage

Method getHttpErrorMessage

lib/Datasource/Github.php:274–291  ·  view source on GitHub ↗
(int $httpCode, array $responseData)

Source from the content-addressed store, hash-verified

272 }
273
274 private function getHttpErrorMessage(int $httpCode, array $responseData): string {
275 if ($httpCode === 401) {
276 return $this->l10n->t('Missing or invalid GitHub access token');
277 }
278 if ($httpCode === 403) {
279 $message = $this->getGithubErrorMessage($responseData);
280 if ($message !== '' && stripos($message, 'rate limit') === false) {
281 return 'GitHub API error: ' . $message;
282 }
283
284 return $this->l10n->t('Rate limit exceeded');
285 }
286 if ($httpCode === 0) {
287 return $this->l10n->t('Report not available');
288 }
289
290 return 'HTTP response code: ' . $httpCode;
291 }
292
293 private function getGithubErrorMessage(array $responseData): string {
294 if (isset($responseData['message']) && is_string($responseData['message'])) {

Callers 1

buildHttpErrorResultMethod · 0.95

Calls 2

getGithubErrorMessageMethod · 0.95
tMethod · 0.45

Tested by

no test coverage detected