From 5fec98d0a733c6a7a2ed01b02d37db091955792a Mon Sep 17 00:00:00 2001 From: Krasi Georgiev Date: Sun, 25 Mar 2018 12:05:59 +0300 Subject: [PATCH] simplify server error handling (#4006) --- web/web.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/web/web.go b/web/web.go index a2212ad69..5d697e00f 100644 --- a/web/web.go +++ b/web/web.go @@ -484,18 +484,13 @@ func (h *Handler) Run(ctx context.Context) error { ReadTimeout: h.options.ReadTimeout, } - go func() { - if err := httpSrv.Serve(httpl); err != nil { - level.Warn(h.logger).Log("msg", "error serving HTTP", "err", err) - } - }() - go func() { - if err := grpcSrv.Serve(grpcl); err != nil { - level.Warn(h.logger).Log("msg", "error serving gRPC", "err", err) - } - }() - errCh := make(chan error) + go func() { + errCh <- httpSrv.Serve(httpl) + }() + go func() { + errCh <- grpcSrv.Serve(grpcl) + }() go func() { errCh <- m.Serve() }()