Show GitHub API error

This commit is contained in:
Jay Trees 2022-01-27 12:53:54 +01:00
parent 82402aca98
commit e230d7ab2b

View file

@ -83,13 +83,17 @@ if ($options) {
use Github\Client;
if ($options) {
$client = new Client();
$release = $client->api('repo')->releases()->latest('grandeljay', 'wishthis');
$tag = $release['tag_name'];
$version = str_replace('v', '', $tag);
try {
$client = new Client();
$release = $client->api('repo')->releases()->latest('grandeljay', 'wishthis');
$tag = $release['tag_name'];
$version = str_replace('v', '', $tag);
if (-1 === version_compare($options->version, $version)) {
$options->updateAvailable = true;
if (-1 === version_compare($options->version, $version)) {
$options->updateAvailable = true;
}
} catch (\Github\Exception\RuntimeException $th) {
echo $th->getMessage();
}
}