From 55ce153545d63d4a8a378efdf3f8ab24102a32b3 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 13 Dec 2020 19:08:09 +0300 Subject: [PATCH] more descriptive error messages Signed-off-by: Vasiliy Tolstov --- consul.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/consul.go b/consul.go index 9a56a8a..e52afa2 100644 --- a/consul.go +++ b/consul.go @@ -3,6 +3,7 @@ package consul import ( "context" "errors" + "fmt" "github.com/hashicorp/consul/api" "github.com/unistack-org/micro/v3/config" @@ -82,9 +83,9 @@ func (c *consulConfig) Init(opts ...config.Option) error { func (c *consulConfig) Load(ctx context.Context) error { pair, _, err := c.cli.KV().Get(c.path, nil) if err != nil { - return err + return fmt.Errorf("consul path load error: %v", err) } else if pair == nil { - return ErrPathNotExist + return fmt.Errorf("consul path not found %v", ErrPathNotExist) } return c.opts.Codec.Unmarshal(pair.Value, c.opts.Struct)