fix: check errors.Is instead of strings.Contains for http: Server closed error (#1779)

This commit is contained in:
Muhammed Kadir Tan 2024-03-12 08:36:35 +03:00 committed by GitHub
parent 860009b866
commit 2afac2469e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,8 +4,10 @@ import (
"bytes"
"crypto/md5"
"encoding/json"
"errors"
"fmt"
"html/template"
"net/http"
"os"
"path"
"path/filepath"
@ -792,7 +794,7 @@ func initHTTPServer(app *App) *echo.Echo {
// Start the server.
go func() {
if err := srv.Start(ko.String("app.address")); err != nil {
if strings.Contains(err.Error(), "Server closed") {
if errors.Is(err, http.ErrServerClosed) {
lo.Println("HTTP server shut down")
} else {
lo.Fatalf("error starting HTTP server: %v", err)