mirror of
https://github.com/nais/wonderwall.git
synced 2026-02-14 17:49:54 +00:00
36 lines
649 B
Go
36 lines
649 B
Go
package templates
|
|
|
|
import (
|
|
_ "embed"
|
|
"html/template"
|
|
"io"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
//go:embed error.gohtml
|
|
var errorGoHtml string
|
|
var errorTemplate *template.Template
|
|
|
|
type ErrorVariables struct {
|
|
CorrelationID string
|
|
CSS template.CSS
|
|
DefaultRedirectURI string
|
|
HttpStatusCode int
|
|
RetryURI string
|
|
}
|
|
|
|
func init() {
|
|
var err error
|
|
|
|
errorTemplate = template.New("error")
|
|
errorTemplate, err = errorTemplate.Parse(errorGoHtml)
|
|
if err != nil {
|
|
log.Fatalf("parsing error template: %+v", err)
|
|
}
|
|
}
|
|
|
|
func ExecError(w io.Writer, vars ErrorVariables) error {
|
|
return errorTemplate.Execute(w, vars)
|
|
}
|