Chore: Handle wrapped errors (#29223)
* Chore: Handle wrapped errors Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
co-authored by
Emil Tullstedt
parent
0cb29d337a
commit
294770f411
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -134,7 +135,7 @@ func (hs *HTTPServer) Run(ctx context.Context) error {
|
||||
switch setting.Protocol {
|
||||
case setting.HTTPScheme, setting.SocketScheme:
|
||||
if err := hs.httpSrv.Serve(listener); err != nil {
|
||||
if err == http.ErrServerClosed {
|
||||
if errors.Is(err, http.ErrServerClosed) {
|
||||
hs.log.Debug("server was shutdown gracefully")
|
||||
return nil
|
||||
}
|
||||
@@ -142,7 +143,7 @@ func (hs *HTTPServer) Run(ctx context.Context) error {
|
||||
}
|
||||
case setting.HTTP2Scheme, setting.HTTPSScheme:
|
||||
if err := hs.httpSrv.ServeTLS(listener, setting.CertFile, setting.KeyFile); err != nil {
|
||||
if err == http.ErrServerClosed {
|
||||
if errors.Is(err, http.ErrServerClosed) {
|
||||
hs.log.Debug("server was shutdown gracefully")
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user