mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-29 06:49:05 +08:00
21 lines
400 B
Go
21 lines
400 B
Go
package handlers
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
func (gh *GRCHandler) errorHandler(w http.ResponseWriter, r *http.Request, status int) {
|
|
w.WriteHeader(status)
|
|
if status == http.StatusNotFound {
|
|
t, err := gh.loadTemplate("/templates/404.html")
|
|
if err != nil {
|
|
log.Println("ERROR: could not get 404 template: ", err)
|
|
http.Error(w, err.Error(), 500)
|
|
return
|
|
}
|
|
|
|
t.Execute(w, nil)
|
|
}
|
|
}
|