improve httpServer error handling

This commit is contained in:
Amolith 2023-09-26 15:32:07 -04:00
parent 1750d9e0e0
commit 61f56f5e80
Signed by: Amolith
GPG Key ID: 8AE30347CE28D101
1 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@ package main
import ( import (
"encoding/csv" "encoding/csv"
"errors"
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
@ -92,7 +93,7 @@ func main() {
mux.HandleFunc("/static", staticHandler) mux.HandleFunc("/static", staticHandler)
mux.HandleFunc("/new", newHandler) 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") log.Println("Web server closed")
} else { } else {
log.Fatalln(err) log.Fatalln(err)