Add other error pages

This commit is contained in:
Eduard Gert
2026-02-04 17:12:26 +01:00
parent 476785b122
commit b5b7dd4f53
2 changed files with 56 additions and 8 deletions

View File

@@ -107,3 +107,15 @@ func ServeHTTP(w http.ResponseWriter, r *http.Request, data any, statusCode ...i
}
w.Write(buf.Bytes())
}
// ServeErrorPage renders a user-friendly error page with the given details.
func ServeErrorPage(w http.ResponseWriter, r *http.Request, code int, title, message string) {
ServeHTTP(w, r, map[string]any{
"page": "error",
"error": map[string]any{
"code": code,
"title": title,
"message": message,
},
}, code)
}