diff --git a/cmd/dwelling-home/main.go b/cmd/dwelling-home/main.go index 1bf2345..4aa0caa 100644 --- a/cmd/dwelling-home/main.go +++ b/cmd/dwelling-home/main.go @@ -54,8 +54,7 @@ func main() { r := httpr.New() r.NotFoundHandler = func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusNotFound) - web.ErrorXXX("/ Not Found", "", "", r.Referer(), http.StatusNotFound, w) + dwhttp.Error(w, http.StatusNotFound, "", "", r.Referer()) } r.ServeStatic("/assets/*filepath", web.Assets()) diff --git a/internal/http/web_handlers.go b/internal/http/web_handlers.go index d8be2f0..3b960d5 100644 --- a/internal/http/web_handlers.go +++ b/internal/http/web_handlers.go @@ -188,6 +188,7 @@ func SitemapXml(w http.ResponseWriter, r *http.Request) { } func Error(w http.ResponseWriter, code int, reason, message, referer string) { + w.WriteHeader(code) web.ErrorXXX("/ "+http.StatusText(code), reason, message, referer, code, w) }