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

Method getHttpErrorMessage

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

Source from the content-addressed store, hash-verified

285 }
286
287 private function getHttpErrorMessage(int $httpCode, array $responseData): string {
288 if ($httpCode === 401) {
289 return $this->l10n->t('Missing or invalid GitHub access token');
290 }
291 if ($httpCode === 403) {
292 $message = $this->getGithubErrorMessage($responseData);
293 if ($message !== '' && stripos($message, 'rate limit') === false) {
294 return 'GitHub API error: ' . $message;
295 }
296
297 return $this->l10n->t('Rate limit exceeded');
298 }
299 if ($httpCode === 0) {
300 return $this->l10n->t('Report not available');
301 }
302
303 return 'HTTP response code: ' . $httpCode;
304 }
305
306 private function getGithubErrorMessage(array $responseData): string {
307 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