From cc8bf98a8bdfe106a73a0f5c1d79bc186d9dd0d2 Mon Sep 17 00:00:00 2001 From: Dogue Date: Sun, 21 Apr 2024 13:59:48 -0400 Subject: [PATCH] Improve error reporting for ZLS installs This commit improves (enables at all, lol?) errors reported to the user regarding problems with downloading ZLS. --- cli/install.go | 6 +++++- main.go | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cli/install.go b/cli/install.go index 09c9e2c..d68ae4f 100644 --- a/cli/install.go +++ b/cli/install.go @@ -275,6 +275,10 @@ func getZLSDownloadUrl(version string, archDouble string) (string, error) { return "", err } + if len(taggedReleaseResponse.Assets) == 0 { + return "", errors.New("invalid ZLS version") + } + // getting platform information var downloadUrl string for _, asset := range taggedReleaseResponse.Assets { @@ -285,7 +289,7 @@ func getZLSDownloadUrl(version string, archDouble string) (string, error) { } if downloadUrl == "" { - return "", errors.New("invalid release URl") + return "", errors.New("invalid ZLS release URL") } return downloadUrl, nil diff --git a/main.go b/main.go index 4a14fa7..c7ff6bf 100644 --- a/main.go +++ b/main.go @@ -110,8 +110,10 @@ func main() { if *installDeps != "" { switch *installDeps { case "zls": - - zvm.InstallZls(req.Package) + + if err := zvm.InstallZls(req.Package); err != nil { + meta.CtaFatal(err) + } } }