From 326ee533339f60243ae67c1652f455b378f48707 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 30 Nov 2021 07:34:49 +0300 Subject: [PATCH] config: add new error type Signed-off-by: Vasiliy Tolstov --- config/config.go | 2 ++ config/default.go | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index f9dbd19f..9b82a477 100644 --- a/config/config.go +++ b/config/config.go @@ -23,6 +23,8 @@ var ( ErrInvalidStruct = errors.New("invalid struct specified") // ErrWatcherStopped is returned when source watcher has been stopped ErrWatcherStopped = errors.New("watcher stopped") + // ErrWatcherNotImplemented returned when config does not implement watch + ErrWatcherNotImplemented = errors.New("watcher not implemented") ) // Config is an interface abstraction for dynamic configuration diff --git a/config/default.go b/config/default.go index d2797ffb..1acc0bdf 100644 --- a/config/default.go +++ b/config/default.go @@ -2,7 +2,6 @@ package config import ( "context" - "fmt" "reflect" "strconv" "strings" @@ -271,7 +270,7 @@ func (c *defaultConfig) Name() string { } func (c *defaultConfig) Watch(ctx context.Context, opts ...WatchOption) (Watcher, error) { - return nil, fmt.Errorf("not implemented") + return nil, ErrWatcherNotImplemented } // NewConfig returns new default config source