Skip to content

Commit 4948a92

Browse files
committed
log stargazer error
1 parent 1abeb8e commit 4948a92

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/GitHub/GetStargazersCount.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,19 @@ final class GetStargazersCount
1212
public function __construct(
1313
private HttpClient $httpClient,
1414
private Cache $cache,
15-
) {
16-
}
15+
) {}
1716

1817
public function __invoke(): ?string
1918
{
2019
return $this->cache->resolve(
2120
key: 'tempest-stargazers',
2221
cache: function () {
23-
try {
24-
$body = $this->httpClient->get('https://api.github.com/repos/tempestphp/tempest-framework')->body;
25-
$stargazers = json_decode($body)->stargazers_count ?? null;
22+
$body = $this->httpClient->get('https://api.github.com/repos/tempestphp/tempest-framework')->body;
23+
$stargazers = json_decode($body)->stargazers_count ?? null;
2624

27-
return $stargazers > 999
28-
? (round($stargazers / 1000, 1) . 'K')
29-
: $stargazers;
30-
} catch (Throwable $e) {
31-
ll($e);
32-
return null;
33-
}
25+
return $stargazers > 999
26+
? (round($stargazers / 1000, 1) . 'K')
27+
: $stargazers;
3428
},
3529
expiresAt: new DateTimeImmutable('+12 hours'),
3630
);

0 commit comments

Comments
 (0)