From 827e5911748f92bbfdb9f450e15d2213b4a128c8 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Tue, 6 Feb 2024 20:39:00 +0000 Subject: [PATCH] chore(settings): clearer error message for surfshark regions - only log possible 'new' server regions - do not log old retro-compatible server regions - maintains compatibility with older names --- internal/configuration/settings/serverselection.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/configuration/settings/serverselection.go b/internal/configuration/settings/serverselection.go index 62715cc0..0c03966f 100644 --- a/internal/configuration/settings/serverselection.go +++ b/internal/configuration/settings/serverselection.go @@ -166,9 +166,12 @@ func getLocationFilterChoices(vpnServiceProvider string, if vpnServiceProvider == providers.Surfshark { // // Retro compatibility // TODO v4 remove - filterChoices.Regions = append(filterChoices.Regions, validation.SurfsharkRetroLocChoices()...) - err := validate.AreAllOneOfCaseInsensitive(ss.Regions, filterChoices.Regions) + newAndRetroRegions := append(filterChoices.Regions, validation.SurfsharkRetroLocChoices()...) //nolint:gocritic + err := validate.AreAllOneOfCaseInsensitive(ss.Regions, newAndRetroRegions) if err != nil { + // Only return error comparing with newer regions, we don't want to confuse the user + // with the retro regions in the error message. + err = validate.AreAllOneOfCaseInsensitive(ss.Regions, filterChoices.Regions) return models.FilterChoices{}, fmt.Errorf("%w: %w", ErrRegionNotValid, err) } }