From f3378b4839a80a65a0c395f1f548ae7691c18239 Mon Sep 17 00:00:00 2001 From: Maksim Ramanenkau Date: Tue, 16 Jan 2024 17:01:01 +0100 Subject: [PATCH] Handle error before proceeding farther --- cmd/chainbridge/main.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/chainbridge/main.go b/cmd/chainbridge/main.go index 71b6c9145..bf09f555d 100644 --- a/cmd/chainbridge/main.go +++ b/cmd/chainbridge/main.go @@ -201,16 +201,15 @@ func run(ctx *cli.Context) error { return errors.New("unrecognized Chain Type") } + if err != nil { + return err + } + if chain.Scan { c.AddChain(newChain) } else { c.SetRouter(newChain) } - - if err != nil { - return err - } - } // Start prometheus and health server @@ -238,7 +237,7 @@ func run(ctx *cli.Context) error { http.HandleFunc(fmt.Sprintf("/health/%s", c.Name()), h.HealthStatus) } // nolint - // ToDo: enable linter after fixint required timeouts vulnerability https://deepsource.io/directory/analyzers/go/issues/GO-S2114 + // ToDo: enable linter after fixint required timeouts vulnerability https://deepsource.io/directory/analyzers/go/issues/GO-S2114 err := http.ListenAndServe(fmt.Sprintf(":%d", port), nil) if errors.Is(err, http.ErrServerClosed) { log.Info("Health status server is shutting down", err)