display path on error

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-07-29 11:13:26 +03:00
parent a3438bcc2f
commit 461d038f01

View File

@ -2,7 +2,6 @@ package consul
import (
"context"
"errors"
"fmt"
"github.com/hashicorp/consul/api"
@ -13,7 +12,6 @@ import (
var (
DefaultStructTag = "consul"
ErrPathNotExist = errors.New("path is not exist")
)
type consulConfig struct {
@ -93,7 +91,7 @@ func (c *consulConfig) Load(ctx context.Context, opts ...config.LoadOption) erro
if err != nil && !c.opts.AllowFail {
return fmt.Errorf("consul path load error: %v", err)
} else if pair == nil && !c.opts.AllowFail {
return fmt.Errorf("consul path not found %v", ErrPathNotExist)
return fmt.Errorf("consul path not found %s", c.path)
}
if err == nil && pair != nil {