mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-10 10:25:36 +08:00
Handle failure in fetching Zig version index
This commit is contained in:
@@ -26,6 +26,9 @@ class zig
|
|||||||
$index_json = default_shell()->executeCurl('https://ziglang.org/download/index.json', retries: $downloader->getRetry());
|
$index_json = default_shell()->executeCurl('https://ziglang.org/download/index.json', retries: $downloader->getRetry());
|
||||||
$index_json = json_decode($index_json ?: '', true);
|
$index_json = json_decode($index_json ?: '', true);
|
||||||
$latest_version = null;
|
$latest_version = null;
|
||||||
|
if ($index_json === null) {
|
||||||
|
throw new DownloaderException('Failed to fetch Zig version index');
|
||||||
|
}
|
||||||
foreach ($index_json as $version => $data) {
|
foreach ($index_json as $version => $data) {
|
||||||
if ($version !== 'master') {
|
if ($version !== 'master') {
|
||||||
$latest_version = $version;
|
$latest_version = $version;
|
||||||
|
|||||||
Reference in New Issue
Block a user