go-tsviewer/features/web/weberror/page.go

23 lines
344 B
Go
Raw Normal View History

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