[#521] Fix issues with transition from pkg/errors pkg

Wrap functions at `pkg/errors` return nil if error argument
was nil. fmt.Errorf always returns error so we need to add
missing error checks to the code.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-05-19 18:36:03 +03:00 committed by Alex Vanin
parent 71b87155ef
commit b5256ccf4c
3 changed files with 14 additions and 6 deletions

View file

@ -111,7 +111,9 @@ func bootstrapNode(c *cfg) {
initState(c)
err := c.cfgNetmap.wrapper.AddPeer(c.toOnlineLocalNodeInfo())
fatalOnErr(fmt.Errorf("bootstrap error: %w", err))
if err != nil {
fatalOnErr(fmt.Errorf("bootstrap error: %w", err))
}
}
func addNetmapNotificationHandler(c *cfg, sTyp string, h event.Handler) {
@ -136,10 +138,14 @@ func setNetmapNotificationParser(c *cfg, sTyp string, p event.Parser) {
func initState(c *cfg) {
epoch, err := c.cfgNetmap.wrapper.Epoch()
fatalOnErr(fmt.Errorf("could not initialize current epoch number: %w", err))
if err != nil {
fatalOnErr(fmt.Errorf("could not initialize current epoch number: %w", err))
}
ni, err := c.netmapLocalNodeState(epoch)
fatalOnErr(fmt.Errorf("could not init network state: %w", err))
if err != nil {
fatalOnErr(fmt.Errorf("could not init network state: %w", err))
}
c.handleNodeInfoStatus(ni)