diff --git a/http_server.go b/http_server.go index 0a86c28..c17844e 100644 --- a/http_server.go +++ b/http_server.go @@ -66,7 +66,7 @@ func (ats *Suite) StartHttpServer() { } err := ats.httpServer.ListenAndServe() - if !errors.Is(err, http.ErrServerClosed) { + if err != nil && !errors.Is(err, http.ErrServerClosed) { // Error starting or closing listener: logrus.Fatal("HTTP server ListenAndServe:", err) } diff --git a/smtp_server.go b/smtp_server.go index a304629..53ba793 100644 --- a/smtp_server.go +++ b/smtp_server.go @@ -24,7 +24,7 @@ func (ats *Suite) StartSmtpServer() { } err := ats.smtpServer.ListenAndServe() - if !errors.Is(err, esmtp.ErrServerClosed) { + if err != nil && !errors.Is(err, esmtp.ErrServerClosed) { // Error starting or closing listener: logrus.Fatal("SMTP server ListenAndServe:", err) }