From 3ed02d5f64646b9bfc6824addb02c1749037fb73 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 16 Sep 2020 11:24:10 +0300 Subject: [PATCH] [#28] Wrap bootstrap errors with prefix message Generic morph invocation errors are more useful, if they have extra info about invocation context. Signed-off-by: Alex Vanin --- cmd/neofs-node/morph.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/neofs-node/morph.go b/cmd/neofs-node/morph.go index 9ad22450d..54b916cb8 100644 --- a/cmd/neofs-node/morph.go +++ b/cmd/neofs-node/morph.go @@ -5,6 +5,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap" "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" + "github.com/pkg/errors" ) func initMorphComponents(c *cfg) { @@ -24,10 +25,10 @@ func bootstrapNode(c *cfg) { fatalOnErr(err) cli, err := netmap.New(staticClient) - fatalOnErr(err) + fatalOnErr(errors.Wrap(err, "bootstrap error")) cliWrapper, err := wrapper.New(cli) - fatalOnErr(err) + fatalOnErr(errors.Wrap(err, "bootstrap error")) peerInfo := new(netmap.NodeInfo) peerInfo.SetAddress(c.viper.GetString(cfgBootstrapAddress)) @@ -35,6 +36,6 @@ func bootstrapNode(c *cfg) { // todo: add attributes as opts err = cliWrapper.AddPeer(peerInfo) - fatalOnErr(err) + fatalOnErr(errors.Wrap(err, "bootstrap error")) } }