From 092760f344039e39b6ef8b91c3917a6c1ca1fd53 Mon Sep 17 00:00:00 2001 From: Mka Madlavana Date: Sat, 23 Jul 2022 14:21:18 +0200 Subject: [PATCH] throw an error if the specified --server is not in server list (#56) --- speedtest/speedtest.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/speedtest/speedtest.go b/speedtest/speedtest.go index 159ef97..8a68092 100644 --- a/speedtest/speedtest.go +++ b/speedtest/speedtest.go @@ -454,6 +454,10 @@ func preprocessServers(servers []defs.Server, forceHTTPS bool, excludes, specifi ret = append(ret, server) } } + if len(ret) == 0 { + error_message := fmt.Sprintf("specified server(s) not found: %v", specific) + return nil, errors.New(error_message) + } return ret, nil } }