From d34aaf900e0caa459a066f8b4d1fdd28b67c39b0 Mon Sep 17 00:00:00 2001 From: shadowy-pycoder <35629483+shadowy-pycoder@users.noreply.github.com> Date: Sat, 16 Nov 2024 18:45:06 +0300 Subject: [PATCH] Slightly changed error messages --- cmd/goso/cli.go | 8 ++++---- goso.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/goso/cli.go b/cmd/goso/cli.go index f43be4d..080413f 100644 --- a/cmd/goso/cli.go +++ b/cmd/goso/cli.go @@ -64,10 +64,10 @@ func root(args []string) error { } else { qn, err = strconv.Atoi(q) if err != nil { - return fmt.Errorf("-q should be within [min=1, max=10], please check your env") + return fmt.Errorf("-q should be within [min=1, max=10], please check if `GOSO_QUESTIONS` is set correctly") } if qn < 1 || qn > 10 { - return fmt.Errorf("-q should be within [min=1, max=10], please check your env") + return fmt.Errorf("-q should be within [min=1, max=10], please check if `GOSO_QUESTIONS` is set correctly") } } a, set := os.LookupEnv("GOSO_ANSWERS") @@ -76,10 +76,10 @@ func root(args []string) error { } else { an, err = strconv.Atoi(a) if err != nil { - return fmt.Errorf("-a should be within [min=1, max=10], please check your env") + return fmt.Errorf("-a should be within [min=1, max=10], please check if `GOSO_ANSWERS` is set correctly") } if an < 1 || an > 10 { - return fmt.Errorf("-a should be within [min=1, max=10], please check your env") + return fmt.Errorf("-a should be within [min=1, max=10], please check if `GOSO_ANSWERS` is set correctly") } } flags := flag.NewFlagSet(app, flag.ExitOnError) diff --git a/goso.go b/goso.go index 95fedc3..9f846f0 100644 --- a/goso.go +++ b/goso.go @@ -329,7 +329,7 @@ func FetchGoogle(conf *Config) (*GoogleSearchResult, error) { } res, err := conf.Client.Do(req) if err != nil { - return nil, err + return nil, fmt.Errorf("failed connecting to Google API: check you internet connection") } defer res.Body.Close() if res.StatusCode > 299 {