From 6e069484cb0a911ba541e07bf04331fadbb76612 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 6 Jan 2025 00:41:32 +0100 Subject: feat(webui): bootstrap session handling and login process --- pkg/webui/error.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 pkg/webui/error.go (limited to 'pkg/webui/error.go') diff --git a/pkg/webui/error.go b/pkg/webui/error.go new file mode 100644 index 0000000..05d8e9e --- /dev/null +++ b/pkg/webui/error.go @@ -0,0 +1,21 @@ +package webui + +import ( + "html/template" + "net/http" +) + +var errorTemplates = template.Must(template.ParseFS(htmlFS, "html/base.html", "html/error.html")) + +func errorResponse(w http.ResponseWriter, status int, err error) { + type ErrorData struct { + Err error + Status int + StatusText string + } + render(w, errorTemplates, status, &ErrorData{ + Err: err, + Status: status, + StatusText: http.StatusText(status), + }) +} -- cgit v1.2.3