tfstated/pkg/webui/error.go
Julien Dessaux 3bb5e735c6
All checks were successful
main / main (push) Successful in 3m13s
main / deploy (push) Has been skipped
main / publish (push) Has been skipped
chore(webui): rewrite all the web session code
#60
2025-04-29 01:25:11 +02:00

23 lines
543 B
Go

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, r *http.Request, status int, err error) {
type ErrorData struct {
Page *Page
Err error
Status int
StatusText string
}
render(w, errorTemplates, status, &ErrorData{
Page: makePage(r, &Page{Title: "Error", Section: "error"}),
Err: err,
Status: status,
StatusText: http.StatusText(status),
})
}