mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-04 12:03:41 +02:00
cmd/thalos/server.go: wrap errors returned to main (to give more context)
This commit is contained in:
parent
e5e15a7645
commit
a36c3f7853
1 changed files with 7 additions and 8 deletions
|
|
@ -236,7 +236,7 @@ func serverCmd(ctx *cli.Context) error {
|
||||||
if len(pidFile) > 0 {
|
if len(pidFile) > 0 {
|
||||||
log.WithField("file", pidFile).Info("Writing pid to file")
|
log.WithField("file", pidFile).Info("Writing pid to file")
|
||||||
if err = pid.Save(pidFile); err != nil {
|
if err = pid.Save(pidFile); err != nil {
|
||||||
return err
|
return fmt.Errorf("pid: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,11 +264,11 @@ func serverCmd(ctx *cli.Context) error {
|
||||||
if len(conf.Log.Filename) > 0 {
|
if len(conf.Log.Filename) > 0 {
|
||||||
stdWriter, err := NewRotatingFileFromConfig(conf.Log, "info")
|
stdWriter, err := NewRotatingFileFromConfig(conf.Log, "info")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("log: %s", err)
|
||||||
}
|
}
|
||||||
errWriter, err := NewRotatingFileFromConfig(conf.Log, "error")
|
errWriter, err := NewRotatingFileFromConfig(conf.Log, "error")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("log: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
|
|
@ -289,7 +289,7 @@ func serverCmd(ctx *cli.Context) error {
|
||||||
|
|
||||||
telegram, err := telegram.New(conf.Telegram.Id)
|
telegram, err := telegram.New(conf.Telegram.Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("telegram: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
telegram.AddReceivers(conf.Telegram.Channel)
|
telegram.AddReceivers(conf.Telegram.Channel)
|
||||||
|
|
@ -308,7 +308,7 @@ func serverCmd(ctx *cli.Context) error {
|
||||||
|
|
||||||
err = rdb.Ping(context.Background()).Err()
|
err = rdb.Ping(context.Background()).Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("redis: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup cache storage
|
// Setup cache storage
|
||||||
|
|
@ -325,7 +325,7 @@ func serverCmd(ctx *cli.Context) error {
|
||||||
eosClient := eos.New(conf.Api)
|
eosClient := eos.New(conf.Api)
|
||||||
chainInfo, err = eosClient.GetInfo(context.Background())
|
chainInfo, err = eosClient.GetInfo(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("eosapi: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
shClient = shipclient.NewStream(func(s *shipclient.Stream) {
|
shClient = shipclient.NewStream(func(s *shipclient.Stream) {
|
||||||
|
|
@ -337,8 +337,7 @@ func serverCmd(ctx *cli.Context) error {
|
||||||
// Get codec
|
// Get codec
|
||||||
codec, err := message.GetCodec(conf.MessageCodec)
|
codec, err := message.GetCodec(conf.MessageCodec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err)
|
return fmt.Errorf("codec: %s", err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chain_id := getChain(chainInfo.ChainID.String())
|
chain_id := getChain(chainInfo.ChainID.String())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue