don't panic on http.ErrServerClosed

This commit is contained in:
Evgeniy Kulikov 2020-02-14 13:07:52 +03:00
parent 307f008dac
commit 468cf49126
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2

View file

@ -3,6 +3,7 @@ package main
import ( import (
"context" "context"
"crypto/ecdsa" "crypto/ecdsa"
"errors"
"net/http" "net/http"
_ "net/http/pprof" _ "net/http/pprof"
"time" "time"
@ -63,7 +64,7 @@ func main() {
l.Info("run gateway server", l.Info("run gateway server",
zap.String("address", v.GetString("listen_address"))) zap.String("address", v.GetString("listen_address")))
if err := e.Start(v.GetString("listen_address")); err != nil { if err := e.Start(v.GetString("listen_address")); err != nil && !errors.Is(err, http.ErrServerClosed) {
l.Panic("could not start server", zap.Error(err)) l.Panic("could not start server", zap.Error(err))
} }
}() }()