aboutsummaryrefslogtreecommitdiff
path: root/pkg/ext/responses.go
blob: d8941e8d6df1cb819a90e2834b6d4ffeca28e826 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package ext

import (
	"fmt"
	"net/http"

	"git.sr.ht/~gabrielgio/img/templates"
)

func NotFound(w http.ResponseWriter) {
	templates.WritePageTemplate(w, &templates.ErrorPage{
		Err: "Not Found",
	}, false)
}

func InternalServerError(w http.ResponseWriter, err error) {
	w.WriteHeader(http.StatusInternalServerError)
	templates.WritePageTemplate(w, &templates.ErrorPage{
		Err: fmt.Sprintf("Internal Server Error:\n%s", err.Error()),
	}, false)
}