From 2d9b59047088cbf79ed81ff1d29ab0c784cb3bde Mon Sep 17 00:00:00 2001 From: Florian Weikert Date: Thu, 21 Nov 2024 17:50:19 +0100 Subject: [PATCH] Improve error message for missing LTS binaries (#639) * Improve error message for missing LTS binaries Follow-up to https://github.com/bazelbuild/bazelisk/pull/636. * Remove obsolete import --- repositories/gcs.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/repositories/gcs.go b/repositories/gcs.go index c74385f0..b9bb3b2b 100644 --- a/repositories/gcs.go +++ b/repositories/gcs.go @@ -5,7 +5,6 @@ package repositories import ( "encoding/json" - "errors" "fmt" "log" "strconv" @@ -42,7 +41,11 @@ func (gcs *GCSRepo) GetLTSVersions(bazeliskHome string, opts *core.FilterOpts) ( return []string{}, err } if len(matches) == 0 { - return []string{}, errors.New("there are no LTS releases or candidates") + var suffix string + if opts.Track > 0 { + suffix = fmt.Sprintf(" for track %d", opts.Track) + } + return []string{}, fmt.Errorf("could not find any LTS Bazel binaries%s", suffix) } return matches, nil }