diff --git a/pkg/config/errors.go b/pkg/config/errors.go new file mode 100644 index 000000000..a1e00a412 --- /dev/null +++ b/pkg/config/errors.go @@ -0,0 +1,5 @@ +package config + +import "errors" + +var ErrNoValidBackends = errors.New("no valid backends configured") diff --git a/pkg/config/loader.go b/pkg/config/loader.go index c5946f13b..ef48206e5 100644 --- a/pkg/config/loader.go +++ b/pkg/config/loader.go @@ -17,7 +17,6 @@ package config import ( - "errors" "net/url" "time" @@ -72,7 +71,7 @@ func Load(applicationName string, applicationVersion string, arguments []string) } if len(c.Backends) == 0 { - return nil, flags, errors.New("no valid backends configured") + return nil, flags, ErrNoValidBackends } ncl, err := negative.ConfigLookup(c.NegativeCacheConfigs).Validate() diff --git a/pkg/config/loader_test.go b/pkg/config/loader_test.go index 769dd71a7..8a128cb92 100644 --- a/pkg/config/loader_test.go +++ b/pkg/config/loader_test.go @@ -620,7 +620,7 @@ func TestLoadConfigurationWarning2(t *testing.T) { func TestLoadEmptyArgs(t *testing.T) { a := []string{} _, _, err := Load("trickster-test", "0", a) - if err == nil { - t.Error("expected error: no valid backends configured") + if err != ErrNoValidBackends { + t.Error("expected error:", ErrNoValidBackends) } }