From 61f56f5e80396d35cad3fb858ce06fdd01cd1752 Mon Sep 17 00:00:00 2001 From: Amolith Date: Tue, 26 Sep 2023 15:32:07 -0400 Subject: [PATCH] improve httpServer error handling --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index a3623ed..4195d7c 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ package main import ( "encoding/csv" + "errors" "fmt" "log" "net/http" @@ -92,7 +93,7 @@ func main() { mux.HandleFunc("/static", staticHandler) mux.HandleFunc("/new", newHandler) - if err := httpServer.ListenAndServe(); err == http.ErrServerClosed { + if err := httpServer.ListenAndServe(); errors.Is(err, http.ErrServerClosed) { log.Println("Web server closed") } else { log.Fatalln(err)