forked from TrueCloudLab/frostfs-node
[#552] cmd/node: Implement error checker with details
Implement function `fatalOnErrDetails` similar to `fatalOnErr` but accepting string details that are written to log output. Use the function everywhere in application code without wrapping in an if-else statement. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ead4513feb
commit
6b1916a529
3 changed files with 13 additions and 13 deletions
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
netmapSDK "github.com/nspcc-dev/neofs-api-go/pkg/netmap"
|
||||
netmapV2 "github.com/nspcc-dev/neofs-api-go/v2/netmap"
|
||||
|
@ -111,9 +110,7 @@ func bootstrapNode(c *cfg) {
|
|||
initState(c)
|
||||
|
||||
err := c.cfgNetmap.wrapper.AddPeer(c.toOnlineLocalNodeInfo())
|
||||
if err != nil {
|
||||
fatalOnErr(fmt.Errorf("bootstrap error: %w", err))
|
||||
}
|
||||
fatalOnErrDetails("bootstrap error", err)
|
||||
}
|
||||
|
||||
func addNetmapNotificationHandler(c *cfg, sTyp string, h event.Handler) {
|
||||
|
@ -138,14 +135,10 @@ func setNetmapNotificationParser(c *cfg, sTyp string, p event.Parser) {
|
|||
|
||||
func initState(c *cfg) {
|
||||
epoch, err := c.cfgNetmap.wrapper.Epoch()
|
||||
if err != nil {
|
||||
fatalOnErr(fmt.Errorf("could not initialize current epoch number: %w", err))
|
||||
}
|
||||
fatalOnErrDetails("could not initialize current epoch number", err)
|
||||
|
||||
ni, err := c.netmapLocalNodeState(epoch)
|
||||
if err != nil {
|
||||
fatalOnErr(fmt.Errorf("could not init network state: %w", err))
|
||||
}
|
||||
fatalOnErrDetails("could not init network state", err)
|
||||
|
||||
c.handleNodeInfoStatus(ni)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue