Skip to content

Commit

Permalink
HTTP and SMTP Server: Checking for non-nil error before comparing to …
Browse files Browse the repository at this point in the history
…ErrServerClosed
  • Loading branch information
Lucas Hinderberger committed Jul 2, 2024
1 parent 58bd796 commit e110c58
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion smtp_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit e110c58

Please sign in to comment.