Skip to content

Commit

Permalink
log error
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Jun 22, 2023
1 parent af25015 commit ea38254
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,11 @@ func startStandAlone(ctx *server.Context, opts StartOptions) error {
}

app := opts.AppCreator(ctx.Logger, db, traceWriter, ctx.Viper)
defer app.Close()
defer func() {
if err := app.Close(); err != nil {
ctx.Logger.Error("close application failed", "error", err.Error())
}
}()

config, err := config.GetConfig(ctx.Viper)
if err != nil {
Expand Down Expand Up @@ -312,7 +316,11 @@ func startInProcess(svrCtx *server.Context, clientCtx client.Context, opts Start
}

app := opts.AppCreator(svrCtx.Logger, db, traceWriter, svrCtx.Viper)
defer app.Close()
defer func() {
if err := app.Close(); err != nil {
logger.Error("close application failed", "error", err.Error())
}
}()

nodeKey, err := p2p.LoadOrGenNodeKey(cfg.NodeKeyFile())
if err != nil {
Expand Down

0 comments on commit ea38254

Please sign in to comment.