display path on error

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-07-29 11:14:21 +03:00
parent 461d038f01
commit fcfa2f31d8
1 changed files with 3 additions and 3 deletions

View File

@ -89,9 +89,9 @@ func (c *consulConfig) Load(ctx context.Context, opts ...config.LoadOption) erro
pair, _, err := c.cli.KV().Get(c.path, nil) pair, _, err := c.cli.KV().Get(c.path, nil)
if err != nil && !c.opts.AllowFail { if err != nil && !c.opts.AllowFail {
return fmt.Errorf("consul path load error: %v", err) return fmt.Errorf("consul path %s load error: %v", c.path, err)
} else if pair == nil && !c.opts.AllowFail { } else if pair == nil && !c.opts.AllowFail {
return fmt.Errorf("consul path not found %s", c.path) return fmt.Errorf("consul path %s not found", c.path)
} }
if err == nil && pair != nil { if err == nil && pair != nil {
@ -140,7 +140,7 @@ func (c *consulConfig) Save(ctx context.Context, opts ...config.SaveOption) erro
} }
if err != nil && !c.opts.AllowFail { if err != nil && !c.opts.AllowFail {
return fmt.Errorf("consul path save error: %v", err) return fmt.Errorf("consul path %s save error: %v", c.path, err)
} }
for _, fn := range c.opts.AfterSave { for _, fn := range c.opts.AfterSave {