blob: f8325f9af14002df016df4f4288ea5618f34211d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package server
import (
"net/http"
)
func errorHandler(w http.ResponseWriter, r *http.Request, status int) {
w.WriteHeader(status)
if status == http.StatusNotFound {
templ := mainTempl.Lookup("404.html")
err := templ.ExecuteTemplate(w, "404.html", r.URL.Path)
if err != nil {
ErrorResponse(w, err.Error(), http.StatusInternalServerError)
return
}
}
}
|