forked from Cliffbreak/tsviewer
22 lines
344 B
Go
22 lines
344 B
Go
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)
|
|
}
|