Add internal server error page

This commit is contained in:
2024-05-13 22:52:00 +07:00
parent 74aae18fee
commit 420140918c
6 changed files with 57 additions and 15 deletions

View File

@ -13,8 +13,18 @@ func init() {
log = logger.Logger()
}
func ALL(w http.ResponseWriter, r *http.Request) {
component := errorView.Main("Not Found")
func NotFound(w http.ResponseWriter, r *http.Request) {
component := errorView.NotFound("Not Found")
err := component.Render(r.Context(), w)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
log.Error(err.Error())
return
}
}
func InternalServerError(w http.ResponseWriter, r *http.Request) {
component := errorView.InternalServerError("Internal Server Error")
err := component.Render(r.Context(), w)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)