This repository has been archived on 2019-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
scoreboard/features/weberror/page.go
2019-05-27 23:46:09 +02:00

24 lines
404 B
Go

package weberror
import (
"html/template"
"io"
)
type ErrorPage struct {
Template template.Template
Error error
StatusCode int
}
func NewPage(t template.Template, err error, statusCode int) *ErrorPage {
return &ErrorPage{
Template: *t.Lookup("error.html"),
Error: err,
StatusCode: statusCode,
}
}
func (page ErrorPage) Send(w io.Writer) {
page.Template.Execute(w, page)
}